First release.
This commit is contained in:
34
src/pages/article/translation/[...translation].astro
Normal file
34
src/pages/article/translation/[...translation].astro
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBody from "../../../components/article/ArticleBody.astro";
|
||||
import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "translation";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { translation: entry.slug },
|
||||
props: { entry },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
|
||||
const articlePrettyName:string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBody collectionName="translation" articleSlug={entry.slug} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
21
src/pages/article/translation/index.astro
Normal file
21
src/pages/article/translation/index.astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="翻译 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按名字排序] <a href="/article/translation/sort_by_timeline">按日期降序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="translation" sortedByTimeline={false}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
||||
21
src/pages/article/translation/sort_by_timeline.astro
Normal file
21
src/pages/article/translation/sort_by_timeline.astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="翻译 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按日期降序] <a href="/article/translation/">按名字排序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="translation" sortedByTimeline={true}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user