Major rewrite for 0.1.6 - Dynamic database entry generation based on json files, dynamic run page generation and more
This commit is contained in:
parent
e75a575417
commit
7fe9e8c25f
28 changed files with 2954 additions and 45 deletions
src/pages
37
src/pages/database.astro
Normal file
37
src/pages/database.astro
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
import Layout from '../layouts/Layout.astro'
|
||||
import QuestListing from '../components/questListing.astro'
|
||||
import DatabaseSection from '../layouts/databaseSection.astro'
|
||||
import { findSlug } from '../utils/slugTools'
|
||||
import type { filedata } from '../types/ta'
|
||||
|
||||
const description =
|
||||
'My own small blog. Topics include FGO, TA, Programming, web technologies and more!'
|
||||
|
||||
const questInfo = []
|
||||
const fulldata = import.meta.glob<{ default: filedata }>(`../content/data/*.json`)
|
||||
|
||||
for (const [key, value] of Object.entries(fulldata)) {
|
||||
const url = `${Astro.url}/${findSlug(key)}`
|
||||
questInfo.push({
|
||||
...(await value())['default'].info,
|
||||
url: url,
|
||||
})
|
||||
}
|
||||
|
||||
questInfo.sort(
|
||||
(a, b) => Date.parse(b.questReleaseDate) - Date.parse(a.questReleaseDate)
|
||||
)
|
||||
---
|
||||
|
||||
<Layout
|
||||
title="TA Database"
|
||||
currentpage="database"
|
||||
descriptionOverride={description}
|
||||
>
|
||||
<DatabaseSection title="FGO NA TA Database">
|
||||
{questInfo.map((quest) => <QuestListing {...quest} />)}
|
||||
</DatabaseSection>
|
||||
</Layout>
|
||||
|
||||
<style></style>
|
23
src/pages/database/[slug].astro
Normal file
23
src/pages/database/[slug].astro
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
import TaShowcaseLayout from '../../layouts/taShowcaseLayout.astro'
|
||||
import {findSlug} from '../../utils/slugTools'
|
||||
|
||||
export function getStaticPaths() {
|
||||
const fulldata = import.meta.glob<{ default: any }>(
|
||||
`../../content/data/*.json`
|
||||
)
|
||||
const keylist = Object.keys(fulldata).map(
|
||||
(item) => findSlug(item)
|
||||
)
|
||||
|
||||
const paths: { params: { slug: string } }[] = []
|
||||
for (const key of keylist) {
|
||||
paths.push({ params: { slug: key! } })
|
||||
}
|
||||
return paths
|
||||
}
|
||||
|
||||
const { slug } = Astro.params
|
||||
---
|
||||
|
||||
<TaShowcaseLayout datafile={slug} />
|
Loading…
Add table
Add a link
Reference in a new issue