fix: 修复归档页面链接生成错误

-   修复归档页面中文章链接生成错误的问题
-   根据文章类型(post或note)动态生成链接,将post指向/posts/,note指向/notes/
This commit is contained in:
KazooTTT
2025-03-06 15:18:16 +08:00
parent a9879a68b1
commit 4feb5e95af

View File

@ -94,7 +94,10 @@ const descYearKeys = Object.keys(groupedByYear).sort((a, b) => +b - +a);
<ul class="flex flex-wrap gap-2">
{latestUpdatedPost.map((post) => (
<li>
<a href={`/${post.collection}/${post.id}/`} class="hover:text-link">
<a
href={`${post.collection === "post" ? "/posts/" : "/notes/"}${post.id}/`}
class="hover:text-link"
>
<span>{post.data.date_modified.toLocaleDateString()}</span>
{post.data.title}
</a>