Skip to content

Commit 259c62c

Browse files
M09Icclaude
andcommitted
feat(landing): add blog section with dynamic post loading from /wiki/blog/
- New blog grid section before footer, auto-fetches latest 6 posts - Parses MkDocs blog index HTML for titles, dates, and excerpts - Card style matches open-source matrix visual language - Responsive: 3-col → 1-col on mobile Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0753fd1 commit 259c62c

1 file changed

Lines changed: 110 additions & 1 deletion

File tree

overrides/home.html

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,68 @@
863863
line-height: 1.45;
864864
}
865865

866+
/* ── blog ── */
867+
.blog-grid {
868+
display: grid;
869+
grid-template-columns: repeat(3, 1fr);
870+
gap: 2px;
871+
}
872+
873+
.blog-card {
874+
padding: 1.5rem 1.65rem;
875+
background: var(--surface);
876+
border: 1px solid var(--border);
877+
clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
878+
display: flex;
879+
flex-direction: column;
880+
gap: 0.5rem;
881+
transition: all 0.3s ease;
882+
}
883+
884+
.blog-card:hover {
885+
background: var(--surface-2);
886+
border-color: var(--border-h);
887+
}
888+
889+
.blog-date {
890+
font-family: var(--mono);
891+
font-size: 0.78rem;
892+
color: var(--text-3);
893+
}
894+
895+
.blog-title {
896+
font-family: var(--display);
897+
font-size: 1.15rem;
898+
font-weight: 700;
899+
color: var(--text);
900+
line-height: 1.35;
901+
}
902+
903+
.blog-excerpt {
904+
font-size: 0.88rem;
905+
color: var(--text-2);
906+
line-height: 1.55;
907+
display: -webkit-box;
908+
-webkit-line-clamp: 2;
909+
-webkit-box-orient: vertical;
910+
overflow: hidden;
911+
}
912+
913+
.blog-more {
914+
margin-top: 1.5rem;
915+
text-align: center;
916+
}
917+
918+
.blog-more a {
919+
font-family: var(--mono);
920+
font-size: 0.85rem;
921+
font-weight: 600;
922+
color: var(--text-3);
923+
transition: color 0.2s;
924+
}
925+
926+
.blog-more a:hover { color: var(--blue); }
927+
866928
/* ── footer ── */
867929
.foot {
868930
padding: 1.75rem 0;
@@ -961,7 +1023,7 @@
9611023
.stats { flex-direction: column; }
9621024
.stat { border-right: none; border-bottom: 1px solid var(--border); }
9631025
.stat:last-child { border-bottom: none; }
964-
.timeline, .products, .matrix, .mx-scenarios { grid-template-columns: 1fr !important; }
1026+
.timeline, .products, .matrix, .mx-scenarios, .blog-grid { grid-template-columns: 1fr !important; }
9651027
.mx-total { flex-direction: column; gap: 1.25rem; }
9661028
.foot-in { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
9671029
}
@@ -1275,6 +1337,18 @@ <h3 class="prod-name" style="color:var(--red);text-shadow:0 0 30px var(--red-glo
12751337
</div>
12761338
</section>
12771339

1340+
<div class="divider"><span class="num">005</span> BLOG</div>
1341+
<section class="sec" id="blog">
1342+
<div class="w">
1343+
<div class="sec-head rv">
1344+
<div class="sec-tag">最新动态</div>
1345+
<h2 class="sec-title">Blog</h2>
1346+
</div>
1347+
<div class="blog-grid rv" id="blogGrid"></div>
1348+
<div class="blog-more rv"><a href="/wiki/blog/">查看全部文章 →</a></div>
1349+
</div>
1350+
</section>
1351+
12781352
</main>
12791353

12801354
<footer class="foot">
@@ -1337,6 +1411,41 @@ <h3 class="prod-name" style="color:var(--red);text-shadow:0 0 30px var(--red-glo
13371411

13381412
document.querySelectorAll('.rv').forEach(function(el) { io.observe(el); });
13391413

1414+
var blogGrid = document.getElementById('blogGrid');
1415+
if (blogGrid) {
1416+
fetch('/wiki/blog/')
1417+
.then(function(r) { return r.text(); })
1418+
.then(function(html) {
1419+
var doc = new DOMParser().parseFromString(html, 'text/html');
1420+
var articles = doc.querySelectorAll('article');
1421+
var count = 0;
1422+
articles.forEach(function(article) {
1423+
if (count >= 6) return;
1424+
var titleEl = article.querySelector('h2 a') || article.querySelector('h2');
1425+
if (!titleEl) return;
1426+
var title = titleEl.textContent.trim();
1427+
if (!title) return;
1428+
var href = titleEl.getAttribute('href') || '';
1429+
if (href && !href.startsWith('http')) href = '/wiki' + href;
1430+
var excerpt = '';
1431+
var contentEl = article.querySelector('.md-post__content p, section p');
1432+
if (contentEl) excerpt = contentEl.textContent.trim().substring(0, 80);
1433+
var dateStr = '';
1434+
var timeEl = article.querySelector('time');
1435+
if (timeEl) dateStr = timeEl.getAttribute('datetime') || timeEl.textContent.trim();
1436+
var card = document.createElement('a');
1437+
card.className = 'blog-card';
1438+
card.href = href;
1439+
if (dateStr) card.innerHTML += '<div class="blog-date">' + dateStr + '</div>';
1440+
card.innerHTML += '<div class="blog-title">' + title + '</div>';
1441+
if (excerpt) card.innerHTML += '<div class="blog-excerpt">' + excerpt + '</div>';
1442+
blogGrid.appendChild(card);
1443+
count++;
1444+
});
1445+
})
1446+
.catch(function() {});
1447+
}
1448+
13401449
fetch('https://api.github.com/orgs/chainreactors/repos?per_page=100')
13411450
.then(function(r) { return r.json(); })
13421451
.then(function(repos) {

0 commit comments

Comments
 (0)