feat: implement barebone zola templates
This commit is contained in:
parent
9c20f5ed2e
commit
f99a9ae2ac
198 changed files with 2434 additions and 227991 deletions
31
_src/components/LocalizedMarkdown.astro
Normal file
31
_src/components/LocalizedMarkdown.astro
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
import i18next from 'i18next';
|
||||
import config from '../../astro-i18next.config.mjs';
|
||||
|
||||
export interface Props {
|
||||
path: string;
|
||||
}
|
||||
|
||||
const { path } = Astro.props;
|
||||
|
||||
const pages = await Astro.glob('../../public/locales/**/*.md');
|
||||
let markdown;
|
||||
|
||||
markdown = pages.find((page) =>
|
||||
page.file.includes(`locales/${i18next.language}/${path}`),
|
||||
);
|
||||
|
||||
if (!markdown) {
|
||||
markdown = pages.find((page) =>
|
||||
page.file.includes(`locales/${config.defaultLocale}/${path}`),
|
||||
);
|
||||
}
|
||||
|
||||
if (!markdown) {
|
||||
throw Error(`The file: "${path}" was not found.`);
|
||||
}
|
||||
|
||||
const { Content } = markdown;
|
||||
---
|
||||
|
||||
<Content />
|
||||
Loading…
Add table
Add a link
Reference in a new issue