File tree Expand file tree Collapse file tree 6 files changed +34
-24
lines changed
content/posts/showing-off-blog-features Expand file tree Collapse file tree 6 files changed +34
-24
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { dateString } from '@utils'
33import { Icon } from ' astro-icon/components'
44import type { CollectionEntry } from ' astro:content'
55import { render } from ' astro:content'
6+ import Tags from ' ./Tags.astro'
67
78interface Props {
89 post: CollectionEntry <' posts' >
@@ -39,15 +40,8 @@ const description = remarkPluginFrontmatter.description || post.data.description
3940 { description && <p class = " my-4 text-base/7 text-foreground" >{ description } </p >}
4041 {
4142 post .data .tags && (
42- <div class = " text-accent mb-6" >
43- { post .data .tags .map ((tag ) => (
44- <a
45- class = " underline mr-4 inline-block"
46- href = { ` /tags/${encodeURIComponent (tag )} ` }
47- >
48- #{ tag }
49- </a >
50- ))}
43+ <div class = " mb-6" >
44+ <Tags tags = { post .data .tags } />
5145 </div >
5246 )
5347 }
Original file line number Diff line number Diff line change 1+ ---
2+ interface Props {
3+ tags: string []
4+ }
5+
6+ const { tags } = Astro .props
7+ ---
8+
9+ <div class =" flex flex-wrap gap-3 text-sm" >
10+ <slot />
11+ {
12+ tags .map ((tag ) => (
13+ <a
14+ href = { ` /tags/${encodeURIComponent (tag )} ` }
15+ class = " py-1 px-3 bg-accent/2 hover:bg-accent/10 border-1 border-accent/10 text-accent/90 rounded-2xl"
16+ >
17+ { tag }
18+ </a >
19+ ))
20+ }
21+ </div >
Original file line number Diff line number Diff line change 22title : ' Showing Off Blog Features'
33published : 2025-07-20
44draft : false
5- tags : ['astro']
5+ tags : ['astro', 'demo', 'markdown' ]
66toc : true
77coverImage :
88 src : ' ./cover.jpg'
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export const getStaticPaths = (async ({ paginate }) => {
1616const { page } = Astro .props
1717---
1818
19- <Layout >
19+ <Layout title = " Archive " description = " All posts in the archive " >
2020 <BlockHeader >Archive</BlockHeader >
2121 <PostPreviewsWithYear posts ={ page .data } />
2222 <Pagination
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import TableOfContents from '@components/TableOfContents.astro'
1010import { Image } from ' astro:assets'
1111import GiscusLoader from ' @components/GiscusLoader.astro'
1212import siteConfig from ' ../../site.config'
13+ import Tags from ' @components/Tags.astro'
1314
1415export const getStaticPaths = (async () => {
1516 const posts = await getSortedPosts ()
@@ -59,7 +60,7 @@ if (addendum.length > 0) {
5960 <h1 class =" mb-3 text-[1.75rem] text-[var(--theme-h1)] font-semibold" >
6061 # { postData .title }
6162 </h1 >
62- <div class =" text-foreground/80 mb-2.5 " >
63+ <div class =" text-foreground/80 mb-1 " >
6364 <time >{ dateString (postData .published )} </time >
6465 {
6566 postData .author && (
@@ -68,21 +69,14 @@ if (addendum.length > 0) {
6869 </span >
6970 )
7071 }
71- </div >
7272 {
7373 postData .tags && (
74- <div class = " text-accent mb-5 lg:mb-0" >
75- { postData .tags .map ((tag ) => (
76- <a
77- class = " underline mr-4 inline-block"
78- href = { ` /tags/${encodeURIComponent (tag )} ` }
79- >
80- #{ tag }
81- </a >
82- ))}
74+ <div class = " mt-4" >
75+ <Tags tags = { postData .tags } />
8376 </div >
8477 )
8578 }
79+ </div >
8680 </div >
8781 <!-- <hr class="border-accent/10 border-2 rounded-xl hidden lg:block" /> -->
8882 <div class =" flex flex-col xl:gap-4 2xl:gap-18 xl:flex-row xl:items-start" >
Original file line number Diff line number Diff line change @@ -23,10 +23,11 @@ export const getStaticPaths = (async ({ paginate }) => {
2323
2424const { page } = Astro .props
2525const { tag } = Astro .params
26+ const title = ` Tag: ${tag } `
2627---
2728
28- <Layout >
29- <BlockHeader ># { tag } </BlockHeader >
29+ <Layout title = { title } description = { ` All posts tagged with ${ tag } ` } >
30+ <BlockHeader >{ title } </BlockHeader >
3031 <PostPreviewsWithYear posts ={ page .data } />
3132 <Pagination
3233 prevLink ={ page .url .prev ? encodeURI (page .url .prev ) : undefined }
You can’t perform that action at this time.
0 commit comments