Skip to content

Commit 8c0c7bc

Browse files
committed
chore(docs): bump astro-pigment to 0.12.0, add markdown alternates to examples pages
1 parent 3bc22d4 commit 8c0c7bc

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

apps/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@nanostores/persistent": "^1.3.3",
1717
"astro": "^6.0.8",
18-
"astro-pigment": "^0.11.1",
18+
"astro-pigment": "^0.12.0",
1919
"es-toolkit": "^1.45.1",
2020
"linkedom": "^0.18.12",
2121
"nanoid": "^5.1.7",

apps/docs/src/pages/examples/[slug].astro

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
import { getCollection, getEntry } from "astro:content";
3-
import { CodeExample } from "astro-pigment/components/playground";
42
import { Layout, PageHeading } from "astro-pigment/components";
5-
import { getHref } from "astro-pigment/utils/urls";
3+
import { CodeExample } from "astro-pigment/components/playground";
4+
import { getHref, getMarkdownAlternate } from "astro-pigment/utils/urls";
5+
import { getCollection, getEntry } from "astro:content";
6+
import nanoTagsContextRaw from "nanotags:dist/context.mjs?raw";
67
import nanoTagsRaw from "nanotags:dist/index.mjs?raw";
78
import nanoTagsRenderRaw from "nanotags:dist/render.mjs?raw";
8-
import nanoTagsContextRaw from "nanotags:dist/context.mjs?raw";
99
import styles from './styles.module.css';
1010
1111
export async function getStaticPaths() {
@@ -27,11 +27,12 @@ const importOverrides = {
2727
const example = await getEntry("examples", Astro.params.slug);
2828
if (!example) throw new Error(`Example '${Astro.params.slug}' not found`);
2929
const data = example.data
30+
const alt = getMarkdownAlternate(`examples/${Astro.params.slug}`);
3031
---
3132

32-
<Layout title={data.title}>
33+
<Layout title={data.title} alternate={[alt]}>
3334
<div class="prose">
34-
<PageHeading title={data.title} href={getHref(`examples/${example.id}.md`)} back={{ href: getHref('examples'), label: 'All Examples' }} />
35+
<PageHeading title={data.title} href={alt.href} back={{ href: getHref('examples'), label: 'All Examples' }} />
3536
{data.descriptionHtml && <p class={styles.subtitle} set:html={data.descriptionHtml} />}
3637
<CodeExample files={data.files} importOverrides={importOverrides} />
3738
<p class={styles.footerNote}>

apps/docs/src/pages/examples/index.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
import { Layout, PageHeading } from "astro-pigment/components";
3-
import { getHref } from "astro-pigment/utils/urls";
3+
import { getHref, getMarkdownAlternate } from "astro-pigment/utils/urls";
44
import { getCollection } from "astro:content";
55
import { EXAMPLES_DESCRIPTION } from "../../extra-entries";
66
import styles from './styles.module.css';
77
88
const examples = await getCollection("examples");
9+
const alt = getMarkdownAlternate("examples");
910
---
1011

11-
<Layout title="Examples">
12-
<PageHeading title="Examples" href={getHref(`examples.md`)} />
12+
<Layout title="Examples" alternate={[alt]}>
13+
<PageHeading title="Examples" href={alt.href} />
1314
<p class={styles.subtitle}>{EXAMPLES_DESCRIPTION}</p>
1415
<div class={styles.grid}>
1516
{examples.map((example) => (

pnpm-lock.yaml

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)