Initialize css-refactor
This commit is contained in:
24
src/pages/archive/category/[category].astro
Normal file
24
src/pages/archive/category/[category].astro
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
import { getCategoryList } from '@utils/content-utils'
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const categories = await getCategoryList()
|
||||
return categories.map(category => {
|
||||
return {
|
||||
params: {
|
||||
category: category.name,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const category = Astro.params.category as string
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
|
||||
<ArchivePanel categories={[category]}></ArchivePanel>
|
||||
</MainGridLayout>
|
||||
11
src/pages/archive/category/uncategorized.astro
Normal file
11
src/pages/archive/category/uncategorized.astro
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
import { UNCATEGORIZED } from '@constants/constants'
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)}>
|
||||
<ArchivePanel categories={[UNCATEGORIZED]}></ArchivePanel>
|
||||
</MainGridLayout>
|
||||
11
src/pages/archive/index.astro
Normal file
11
src/pages/archive/index.astro
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)}>
|
||||
<ArchivePanel></ArchivePanel>
|
||||
</MainGridLayout>
|
||||
|
||||
32
src/pages/archive/tag/[tag].astro
Normal file
32
src/pages/archive/tag/[tag].astro
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
import { getSortedPosts } from '@utils/content-utils'
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
let posts = await getSortedPosts()
|
||||
|
||||
const allTags = posts.reduce((acc, post) => {
|
||||
post.data.tags.forEach(tag => acc.add(tag))
|
||||
return acc
|
||||
}, new Set())
|
||||
|
||||
const allTagsArray = Array.from(allTags)
|
||||
|
||||
return allTagsArray.map(tag => {
|
||||
return {
|
||||
params: {
|
||||
tag: tag,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const tag = Astro.params.tag as string
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
|
||||
<ArchivePanel tags={[tag]}></ArchivePanel>
|
||||
</MainGridLayout>
|
||||
Reference in New Issue
Block a user