Skip to content

Commit bb26e92

Browse files
committed
Add friend links page and navigation
1 parent d970257 commit bb26e92

5 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎src/components/Footer.astro‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const year = new Date().getFullYear();
1111
<nav class="footer-links" aria-label="页脚导航">
1212
<a href="/atom.xml">RSS 订阅 <span aria-hidden="true">↗</span></a>
1313
<a href="https://github.com/SpriCoder" target="_blank" rel="noopener noreferrer">GitHub <span aria-hidden="true">↗</span></a>
14+
<a href="/links/">友链</a>
1415
<a href="/about/">关于我</a>
1516
</nav>
1617
</div>

‎src/components/Header.astro‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const links = [
44
{ href: '/', label: '首页' },
55
{ href: '/series/', label: '专题' },
66
{ href: '/archives/', label: '归档' },
7+
{ href: '/links/', label: '友链' },
78
{ href: '/about/', label: '关于' },
89
];
910
const active = (href: string) => href === '/' ? pathname === '/' : href === '/series/' ? pathname.startsWith('/series/') || pathname.startsWith('/courses/') : pathname.startsWith(href);

‎src/pages/[...path].astro‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function getStaticPaths() {
88
const paths = posts.map(post => ({ params: { path: post.url.replace(/^\/+|\/+$/g, '') }, props: { post, posts } }));
99
const occupied = new Set(posts.map(post => post.url));
1010
for (const listing of legacyRoutes) {
11+
if (listing.kind === 'links') continue;
1112
if (!occupied.has(listing.url)) paths.push({ params: { path: listing.url.replace(/^\/+|\/+$/g, '') }, props: { listing, posts } });
1213
}
1314
for (const kind of ['tags', 'categories', 'archives']) {

‎src/pages/links.astro‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
import SiteLayout from '../layouts/SiteLayout.astro';
3+
---
4+
5+
<SiteLayout title="友链" description="朋友的博客与个人网站。">
6+
<div class="container">
7+
<header class="page-header"><h1>友链</h1></header>
8+
<ul class="archive-list">
9+
<li><a href="https://tanxinyu.work/" target="_blank" rel="noopener noreferrer">谭新宇的博客 <small>tanxinyu.work <span aria-hidden="true">↗</span></small></a></li>
10+
</ul>
11+
</div>
12+
</SiteLayout>

‎src/styles/global.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ main { min-height: 55vh; outline: none; }
6666
.header-navigation, .main-nav, .header-tools { display: flex; align-items: center; }
6767
.header-navigation { gap: 32px; }
6868
.main-nav { gap: 28px; font-size: 14px; }
69-
.main-nav a { padding: 8px 0; position: relative; }
69+
.main-nav a { padding: 8px 0; position: relative; white-space: nowrap; }
7070
.main-nav a::after { content: ''; height: 2px; position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .18s ease; }
7171
.main-nav a:hover::after, .main-nav a.active::after { transform: scaleX(1); }
7272
.main-nav a.active { color: var(--ink); font-weight: 600; }
@@ -373,7 +373,7 @@ html[data-theme='dark'] .theme-icon-moon { display: none; }
373373
@media (max-width: 480px) {
374374
.header-inner { display: grid; grid-template-columns: 1fr; gap: 14px; }
375375
.header-navigation { justify-content: space-between; }
376-
.main-nav { gap: 27px; }
376+
.main-nav { gap: 16px; }
377377
.header-tools { border: 0; }
378378
}
379379
@media (prefers-reduced-motion: reduce) {

0 commit comments

Comments
 (0)