<h1 class="admin-page-title">クラスター</h1> <p class="admin-page-meta">pillar ページを軸にした記事群の戦略マップ。</p>
<script id="articles-data" type="application/json">{{ site.data.articles | jsonify }}</script>
{% assign clusters = site.data.dashboard.clusters %} {% assign tree = site.data.articles.tree_by_category %} {% assign cats = site.data.taxonomy.categories %}
{% if clusters and clusters.size > 0 %}
<div class="cluster-grid"> {% for cluster in clusters %} {% assign needs_attention = false %} {% if cluster.entries_count < 2 %}{% assign needs_attention = true %}{% endif %} {% assign goal = cluster.goal | default: 5 %} {% assign pct = cluster.entries_count | times: 100 | divided_by: goal %}
<div class="cluster-card{% if needs_attention %} cluster-card--attention{% endif %}"> <div style="display:flex;align-items:center;gap:8px;margin-bottom:8px;"> <p class="cluster-card-title" style="margin:0;">{{ cluster.name | default: "—" }}</p> {% if needs_attention %} <span class="badge badge--warn">要補充</span> {% endif %} </div>
<p class="cluster-card-meta"> ID: <span style="font-family:var(--font-family-mono);font-size:11px;">{{ cluster.id | default: "—" }}</span><br> pillar: {% if cluster.pillar_page and cluster.pillar_page != "" %} <a href="{{ cluster.pillar_page | relative_url }}" style="font-size:12px;">{{ cluster.pillar_page }}</a> {% else %}<span style="color:var(--color-fg-muted);">未設定</span>{% endif %}<br> 対象 KW: {{ cluster.target_kw | default: "—" }}<br> 記事数: <strong style="font-family:var(--font-family-mono);">{{ cluster.entries_count | default: "0" }}</strong> </p>
<div class="progress-bar" aria-label="{{ cluster.entries_count | default: 0 }} / {{ goal }} 件"> <div class="progress-fill" style="width:{% if pct > 100 %}100{% else %}{{ pct }}{% endif %}%;"></div> </div> <p style="font-size:11px;color:var(--color-fg-muted);margin:4px 0 12px;">{{ cluster.entries_count | default: "0" }} / {{ goal }} 件</p>
{% if cluster.entries and cluster.entries.size > 0 %} <ul class="cluster-entries"> {% for entry in cluster.entries %} <li> <a href="{{ entry.path | relative_url }}">{{ entry.title | default: entry.path | default: "—" }}</a> </li> {% endfor %} </ul> {% else %} <p style="font-size:12px;color:var(--color-fg-muted);">記事未登録。</p> {% endif %} </div> {% endfor %} </div>
{% else %}
<h2 class="admin-section-title">カテゴリ別記事構造</h2> <p style="font-size:12px;color:var(--color-fg-muted);margin-bottom:1rem;"><code>_data/dashboard.json</code> にクラスターデータがないため、<code>articles.json</code> の階層構造を表示します。</p>
{% for cat in cats %} {% assign cat_nodes = tree[cat.id] %} {% if cat_nodes and cat_nodes.size > 0 %} <details style="margin-bottom:1rem;border:1px solid var(--color-border-default);border-radius:4px;padding:0 1rem;"> <summary style="cursor:pointer;padding:0.75rem 0;font-weight:500;font-size:14px;list-style:none;"> {{ cat.name_jp }} <span style="font-family:var(--font-family-mono);font-size:12px;color:var(--color-fg-muted);margin-left:8px;">{{ cat.article_count }} 件</span> </summary> <ul style="margin:0 0 0.75rem;padding:0 0 0 1rem;font-size:13px;"> {% for node in cat_nodes %} <li style="margin:4px 0;"> <a href="{{ node.path | remove: '.md' | prepend: '/' | append: '/' | relative_url }}">{{ node.title | default: node.path }}</a> {% if node.children and node.children.size > 0 %} <ul style="padding-left:1rem;margin:4px 0;"> {% for child in node.children %} <li style="margin:2px 0;"> <span style="color:var(--color-fg-muted);font-family:var(--font-family-mono);font-size:11px;">└─ </span> <a href="{{ child.path | remove: '.md' | prepend: '/' | append: '/' | relative_url }}">{{ child.title | default: child.path }}</a> {% if child.children and child.children.size > 0 %} <ul style="padding-left:1rem;margin:2px 0;"> {% for gc in child.children %} <li style="margin:2px 0;"> <span style="color:var(--color-fg-muted);font-family:var(--font-family-mono);font-size:11px;">└─ </span> <a href="{{ gc.path | remove: '.md' | prepend: '/' | append: '/' | relative_url }}">{{ gc.title | default: gc.path }}</a> </li> {% endfor %} </ul> {% endif %} </li> {% endfor %} </ul> {% endif %} </li> {% endfor %} </ul> </details> {% endif %} {% endfor %}
{% endif %}