-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a wrapper function for getCollection which does not return any draft pages when in production. This allows us to incrementally migrate the legacy API reference
- Loading branch information
1 parent
10ea7d2
commit 6a50523
Showing
12 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Introduction - Draft | ||
description: Draft Introduction | ||
nav: | ||
path: API/Getting Started | ||
order: 1 | ||
--- | ||
|
||
Setting `draft: true` in the front matter of the guide means this page will not be published in production. This allows us to incrementally migrate the legacy API reference. We will remove this once we migrate the first api reference page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Draft | ||
description: Draft guide that is not published in production | ||
draft: true | ||
nav: | ||
path: Reference/Centrapay Experiences | ||
order: 2 | ||
--- | ||
|
||
Setting `draft: true` in the front matter of the guide means this page will not be published in production. This allows us to incrementally migrate the legacy API reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
import { getCollection } from '../../utils/getCollection'; | ||
import Prose from '../../components/Prose.vue'; | ||
import TocNav from '../../components/TocNav.vue'; | ||
import BaseLayout from '../../layouts/BaseLayout.astro'; | ||
import customComponents from '../../utils/customComponents'; | ||
export async function getStaticPaths() { | ||
const api = await getCollection('api'); | ||
return api.map(entry => ({ | ||
params: { slug: entry.slug }, | ||
props: { entry }, | ||
})); | ||
} | ||
const { entry } = Astro.props; | ||
const { Content, headings } = await entry.render(); | ||
const { title, description } = entry.data; | ||
--- | ||
<BaseLayout title={title} description={description}> | ||
<div class="relative mx-auto desktop-gutters flex justify-center"> | ||
<div class="min-w-0 max-w-2xl flex-auto px-8 pb-16 pt-8 xl:pt-16 lg:max-w-none"> | ||
<article> | ||
<header class="mb-9 space-y-1" > | ||
<h1 | ||
class="font-display text-3xl tracking-tight text-slate-900" | ||
> | ||
{ title } | ||
</h1> | ||
</header> | ||
<Prose client:load> | ||
<Content components={customComponents}/> | ||
</Prose> | ||
</article> | ||
</div> | ||
<div class="hidden xl:sticky border-none xl:top-[4.5rem] xl:block xl:h-[calc(100vh-4.5rem)] xl:flex-none xl:py-16 xl:pr-6 overflow-y-auto"> | ||
<TocNav client:load headings={headings} /> | ||
</div> | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { getCollection as get } from 'astro:content'; | ||
|
||
export async function getCollection(collection) { | ||
return await get(collection, ({ data }) => { | ||
return import.meta.env.MODE === 'production' ? data.draft !== true : true; | ||
}); | ||
} |