add external content

This commit is contained in:
Alexander Navarro 2023-06-26 17:27:50 -04:00
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
View file

@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View file

View 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>

View 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>