feat: add tags on post page.

This commit is contained in:
Yufan Sheng 2024-07-03 04:03:53 +08:00
parent f24e166cee
commit d3f76c2c85
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B
2 changed files with 15 additions and 5 deletions

View File

@ -843,9 +843,6 @@
box-shadow: none !important; box-shadow: none !important;
} }
@media (max-width: 767.98px) {
}
.blur { .blur {
-webkit-filter: blur(3px); -webkit-filter: blur(3px);
filter: blur(3px); filter: blur(3px);

View File

@ -7,7 +7,7 @@ import PostMeta from '@/components/meta/PostMeta.astro';
import MusicPlayer from '@/components/player/MusicPlayer.astro'; import MusicPlayer from '@/components/player/MusicPlayer.astro';
import Sidebar from '@/components/sidebar/Sidebar.astro'; import Sidebar from '@/components/sidebar/Sidebar.astro';
import { formatShowDate } from '@/helpers/formatter'; import { formatShowDate } from '@/helpers/formatter';
import { posts, tags, type Post } from '@/helpers/schema'; import { getTag, posts, tags, type Post } from '@/helpers/schema';
import { urlJoin } from '@/helpers/tools'; import { urlJoin } from '@/helpers/tools';
import BaseLayout from '@/layouts/BaseLayout.astro'; import BaseLayout from '@/layouts/BaseLayout.astro';
import options from '@/options'; import options from '@/options';
@ -38,7 +38,20 @@ const { Content } = await post.render();
<div class="card-body"> <div class="card-body">
<h1 class="post-title">{post.title}</h1> <h1 class="post-title">{post.title}</h1>
<div class="post-meta text-sm text-muted mt-3 mb-4"> <div class="post-meta text-sm text-muted mt-3 mb-4">
<time>{formatShowDate(post.date)}</time> <time class="">{formatShowDate(post.date)}</time>
{
post.tags.length > 0 &&
post.tags
.map((tag) => getTag(tag, undefined))
.filter((tag) => tag !== undefined)
.map((tag) => (
<>
<a class="float-end ms-2 badge badge-light badge-pill" href={`/tags/${tag.slug}`}>
{tag.name}
</a>
</>
))
}
</div> </div>
<div class="post-content"> <div class="post-content">
<div class="nc-light-gallery"> <div class="nc-light-gallery">