-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path[...slug].astro
More file actions
53 lines (48 loc) · 1.22 KB
/
Copy path[...slug].astro
File metadata and controls
53 lines (48 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
import { getCollection, render } from "astro:content";
import DocLayout from "../layouts/DocLayout.astro";
import { buildPages } from "../lib/nav";
export async function getStaticPaths() {
const entries = await getCollection("docs");
const pages = buildPages(entries);
return pages.map((page) => {
const entry = entries.find((e) => e.id === page.id)!;
return {
params: { slug: page.slug },
props: { page, entry },
};
});
}
const { page, entry } = Astro.props;
const { Content, headings } = await render(entry);
const sectionPath = `/${page.section}/`;
const jsonLd = {
"@context": "https://schema.org",
"@type": "Article",
"headline": page.title,
"description": entry.data.description || "",
"author": {
"@type": "Person",
"name": "Branimir Georgiev",
"url": "https://github.com/braboj"
},
"publisher": {
"@type": "Person",
"name": "Branimir Georgiev"
},
"isPartOf": {
"@type": "Course",
"name": "Git Tutorial — Code with Branko",
"url": "https://braboj.github.io/tutorial-git/"
}
};
---
<DocLayout
title={page.title}
description={entry.data.description}
headings={headings}
currentPath={sectionPath}
jsonLd={jsonLd}
>
<Content />
</DocLayout>