forked from withastro/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(check): Add
astro check
step (withastro#2341)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
- Loading branch information
1 parent
76c0482
commit 335fb88
Showing
20 changed files
with
61 additions
and
50 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
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
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
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
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
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
--- | ||
import { MarkdownInstance } from 'astro'; | ||
import languages from '../../i18n/languages'; | ||
import { groupPagesByLang } from '../../util/groupPagesByLang'; | ||
export async function getStaticPaths() { | ||
const allPages = await Astro.glob('../**/*.{md,mdx}'); | ||
const allPages = await Astro.glob<MarkdownInstance<{}>>('../**/*.{md,mdx}'); | ||
const pagesByLang = groupPagesByLang(allPages); | ||
const paths = []; | ||
for (const { url } of pagesByLang.en) { | ||
const slug = url.slice(4); | ||
const slug = url!.slice(4); | ||
for (const lang of Object.keys(languages)) { | ||
if (lang === 'en') continue; | ||
const doesNotNeedFallback = pagesByLang[lang]?.some((p) => p.url.endsWith(slug)); | ||
const doesNotNeedFallback = pagesByLang[lang]?.some((p) => p.url!.endsWith(slug)); | ||
if (doesNotNeedFallback) continue; | ||
paths.push({ params: { lang, fallback: slug } }); | ||
} | ||
} | ||
return paths; | ||
} | ||
const { fallback } = Astro.params; | ||
const englishPages = await Astro.glob('../en/**/*.{md,mdx}'); | ||
const { Content } = englishPages.find((p) => p.url.endsWith(fallback)); | ||
const englishPages = await Astro.glob<MarkdownInstance<{}>>('../en/**/*.{md,mdx}'); | ||
const { Content } = englishPages.find((p) => p.url!.endsWith(Astro.params.fallback as string))!; | ||
--- | ||
|
||
<Content /> |