Skip to content

Commit

Permalink
Converts existing privacy and terms pages to use content collections
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerchew committed Jan 5, 2025
1 parent 77f2ed1 commit c9f8809
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/pages/privacy.astro
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import { render, getEntry } from "astro:content";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("privacy");
const entry = await getEntry("policy", "privacy");
if (entry === undefined)
throw new Error(
"Entry `privacy` was undefined, this could mean the source file is under a different path.",
);
const { Content } = await render(entry);
---

<ProseLayout
title="Privacy"
description="The privacy of your data—and it is your data, not ours!—is a big deal to us. Here’s the rundown of what we collect and why, when we access your information, and your rights."
color="brown"
>
<article set:html={content} />
<Content />
</ProseLayout>
13 changes: 10 additions & 3 deletions src/pages/terms.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
---
import { fetchPolicy } from "~/helpers/helpers";
import { render, getEntry } from "astro:content";
import ProseLayout from "~/layouts/ProseLayout.astro";
const content = await fetchPolicy("terms");
const entry = await getEntry("policy", "terms");
if (entry === undefined)
throw new Error(
"Entry `terms` was undefined, this could mean the source file is under a different path.",
);
const { Content } = await render(entry);
---

<ProseLayout
Expand All @@ -11,5 +18,5 @@ const content = await fetchPolicy("terms");
color="brown"
annotation="box"
>
<article set:html={content} />
<Content />
</ProseLayout>

0 comments on commit c9f8809

Please sign in to comment.