diff --git a/src/components/blog/tag/TagListSection.astro b/src/components/blog/tag/TagListSection.astro index 6890ce4..04efdd3 100644 --- a/src/components/blog/tag/TagListSection.astro +++ b/src/components/blog/tag/TagListSection.astro @@ -13,6 +13,5 @@ const { title, tags } = Astro.props
{title} -
diff --git a/src/components/blog/tag/TagSmallList.astro b/src/components/blog/tag/TagSmallList.astro index f089743..da37cf9 100644 --- a/src/components/blog/tag/TagSmallList.astro +++ b/src/components/blog/tag/TagSmallList.astro @@ -14,7 +14,7 @@ const { blogCategory, tags } = Astro.props
  • {BlogCategoryMapping[blogCategory]}
  • diff --git a/src/components/layout/nav/BlogNav.astro b/src/components/layout/nav/BlogNav.astro index 8b280a4..dcdc9f6 100644 --- a/src/components/layout/nav/BlogNav.astro +++ b/src/components/layout/nav/BlogNav.astro @@ -22,7 +22,7 @@ const navList = [ ] as const satisfies { target: string; title: string; isHere: boolean }[] --- -
    +
    { navList.map(({ target, title, isHere }) => ( - {title} + + {title} + )) } diff --git a/src/pages/blog/[category].astro b/src/pages/blog/[category].astro index 9b8c3cc..abc546a 100644 --- a/src/pages/blog/[category].astro +++ b/src/pages/blog/[category].astro @@ -1,9 +1,6 @@ --- -import BlogLayout from '@/layouts/BlogLayout.astro' -import { getCollection } from 'astro:content' -import BlogListSection from '@/components/blog/BlogListSection.astro' import { BlogCategoryMapping, type BlogCategory } from '@/content/config' -import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro' +import IndexPage from './_IndexPage.astro' export function getStaticPaths() { return (Object.keys(BlogCategoryMapping) as BlogCategory[]).map( @@ -15,16 +12,6 @@ export function getStaticPaths() { } const { category } = Astro.props - -const blogEntries = (await getCollection('blogs')).filter( - ({ data: { category: c } }) => c === category, -) --- - -
    - - - -
    -
    + diff --git a/src/pages/blog/_IndexPage.astro b/src/pages/blog/_IndexPage.astro new file mode 100644 index 0000000..82ed27f --- /dev/null +++ b/src/pages/blog/_IndexPage.astro @@ -0,0 +1,25 @@ +--- +import BlogLayout from '@/layouts/BlogLayout.astro' +import { getCollection } from 'astro:content' +import BlogListSection from '@/components/blog/BlogListSection.astro' +import type { BlogCategory } from '@/content/config' +import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro' + +interface Props { + category: 'all' | BlogCategory +} + +const { category } = Astro.props + +const blogEntries = (await getCollection('blogs')).filter( + ({ data: { category: c } }) => category === 'all' || c === category, +) +--- + + +
    + + + +
    +
    diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 8812dbe..75a72ed 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,16 +1,5 @@ --- -import BlogLayout from '@/layouts/BlogLayout.astro' -import { getCollection } from 'astro:content' -import BlogListSection from '@/components/blog/BlogListSection.astro' -import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro' - -const blogEntries = await getCollection('blogs') +import IndexPage from './_IndexPage.astro' --- - -
    - - - -
    -
    + diff --git a/src/pages/blog/tags/[slug].astro b/src/pages/blog/tags/[slug].astro index 4ba0de2..1c371b5 100644 --- a/src/pages/blog/tags/[slug].astro +++ b/src/pages/blog/tags/[slug].astro @@ -26,6 +26,8 @@ const ogpPath = ( format: 'png', }) ).src + +const isShowAbout = tag.description || tag.links.length > 0 ---
    - + {isShowAbout && } b.data.tags.some((t) => t.id === id))} diff --git a/src/pages/blog/tags/index.astro b/src/pages/blog/tags/index.astro index 8aae4da..5206717 100644 --- a/src/pages/blog/tags/index.astro +++ b/src/pages/blog/tags/index.astro @@ -3,6 +3,7 @@ import BlogLayout from '@/layouts/BlogLayout.astro' import { getCollection } from 'astro:content' import { getTagStatistics } from '@/content/_blog-statistics' import TagListSection from '@/components/blog/tag/TagListSection.astro' + const tagEntries = await getCollection('tags') const statistics = await getTagStatistics() const tags = tagEntries