refactor: clean up configuration and components, optimize implementation details

- Remove unused navigation bar and social link configurations
- Update Footer component, simplify code
- Refactor PostList and PostTime components, improve code readability
- Adjust Waline comment component styles
- Streamline content config and reading time plugin
- Update theme guide document titles and tags
This commit is contained in:
radishzzz 2025-03-12 01:05:15 +00:00
parent 8ac9b865f5
commit c23a54ae83
10 changed files with 33 additions and 126 deletions

View file

@ -6,28 +6,29 @@ interface Post {
title: string
abbrlink?: string
published: Date
lang?: string
}
// URL path automatically generated by Astro based on the filename
slug?: string
// Optional for robustness in case render() fails or plugin isn't applied
remarkPluginFrontmatter?: {
minutes?: number
}
}
// Receive posts parameter passed from outside
const { posts, lang: pageLang } = Astro.props
// Get post list and page language parameter from props
const { posts, lang } = Astro.props
// Declare the type of props
export interface Props {
posts: Post[]
lang?: string
}
// 构建正确的链接路径
function getPostUrl(post: Post) {
// Get multilingual post URL path
function getPostPath(post: Post) {
// If abbrlink is set, it will be used instead of slug
const postPath = post.data.abbrlink || post.slug
// 如果是在语言文件夹下的页面,添加语言前缀
return pageLang ? `/${pageLang}/posts/${postPath}/` : `/posts/${postPath}/`
// Add language prefix to URL if current page is in a language subdirectory
return lang ? `/${lang}/posts/${postPath}/` : `/posts/${postPath}/`
}
---
<ul>
@ -37,7 +38,7 @@ function getPostUrl(post: Post) {
{/* post title */}
<a
class="hover:c-primary"
href={getPostUrl(post)}
href={getPostPath(post)}
transition:name={`post-${post.data.abbrlink || post.slug}`}
data-disable-transition-on-theme
>