mirror of
https://github.com/jimeh/commonflow.org.git
synced 2026-02-19 05:46:40 +00:00
feat: render current spec on index page instead of redirecting
- Update index.astro to fetch and render the current spec version
directly rather than redirecting to /spec/{version}
- Move .spec-content styles from [version].astro to global.css
to share styles between index and version pages
- Rebuild site with new index page
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
---
|
||||
import { getCollection, render } from "astro:content";
|
||||
import Default from "../layouts/Default.astro";
|
||||
import { config } from "../config";
|
||||
|
||||
// Redirect to current version
|
||||
return Astro.redirect(`/spec/${config.currentVersion}`);
|
||||
// Get all specs and find the current version
|
||||
const specs = await getCollection("spec");
|
||||
const currentSpec = specs.find((s) => s.data.version === config.currentVersion);
|
||||
|
||||
if (!currentSpec) {
|
||||
return Astro.redirect("/404");
|
||||
}
|
||||
|
||||
const { Content } = await render(currentSpec);
|
||||
---
|
||||
|
||||
<Default title={currentSpec.data.title} version={currentSpec.data.version}>
|
||||
<article class="spec-content">
|
||||
<Content />
|
||||
</article>
|
||||
</Default>
|
||||
|
||||
Reference in New Issue
Block a user