add external content
This commit is contained in:
parent
e515ed76a2
commit
0d876f50a9
8 changed files with 94 additions and 6 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 758b5cabb6f4924cbe85a554547c21d58d3448e1
|
||||
Subproject commit ed0d837f9fd2dd3b86903ef46666eff7b82b1856
|
||||
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
|
|
@ -1 +1,2 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference types="astro/client" />
|
||||
|
|
|
|||
46
src/pages/games/[...slug].astro
Normal file
46
src/pages/games/[...slug].astro
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
import {
|
||||
InferGetStaticParamsType,
|
||||
InferGetStaticPropsType,
|
||||
GetStaticPaths,
|
||||
} from 'astro';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const games = await getCollection('games');
|
||||
|
||||
return games.map((entry) => ({
|
||||
params: { slug: entry.slug },
|
||||
props: entry,
|
||||
}));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
|
||||
|
||||
const entry = Astro.props;
|
||||
const { Content, headings } = await entry.render();
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
{
|
||||
headings.map((header) => (
|
||||
<li>
|
||||
<a href={`#${header.slug}`}>
|
||||
{header.depth} - {header.text}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
|
||||
<Content />
|
||||
</body>
|
||||
</html>
|
||||
15
src/pages/games/index.astro
Normal file
15
src/pages/games/index.astro
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
const games = await getCollection('games');
|
||||
---
|
||||
|
||||
<h1>Games</h1>
|
||||
|
||||
<ul>
|
||||
{games.map(item => (
|
||||
<li>
|
||||
<a href={`games/${item.slug}`}>{item.data.Title}</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
Loading…
Add table
Add a link
Reference in a new issue