Better microformats support and add PUBLISH_DRAFTS envvar
This commit is contained in:
parent
132b2b69f3
commit
a335aff2d3
31 changed files with 269 additions and 153 deletions
|
|
@ -2,6 +2,7 @@
|
|||
import type { GetStaticPaths } from "astro";
|
||||
import { type CollectionEntry, getCollection } from "astro:content";
|
||||
import GameLayout from "../../layouts/GameLayout.astro";
|
||||
import { PUBLISH_DRAFTS } from "astro:env/server";
|
||||
|
||||
type Props = CollectionEntry<"games">;
|
||||
|
||||
|
|
@ -11,10 +12,12 @@ type Params = {
|
|||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
const games = await getCollection("games");
|
||||
return games.map((game) => ({
|
||||
params: { slug: game.slug } satisfies Params,
|
||||
props: game satisfies Props,
|
||||
}));
|
||||
return games
|
||||
.filter((game) => import.meta.env.DEV || PUBLISH_DRAFTS || !game.data.isDraft)
|
||||
.map((game) => ({
|
||||
params: { slug: game.slug } satisfies Params,
|
||||
props: game satisfies Props,
|
||||
}));
|
||||
};
|
||||
|
||||
const game = Astro.props;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue