added TOC and editorial content
This commit is contained in:
parent
346c154259
commit
bf2221b9a9
25 changed files with 363 additions and 275 deletions
|
@ -1,26 +1,29 @@
|
|||
---
|
||||
import { astroI18n } from "astro-i18n";
|
||||
import { l, t, astroI18n } from "astro-i18n";
|
||||
import { log } from "astro/dist/core/logger/core";
|
||||
import { literal } from "astro/zod";
|
||||
astroI18n.init(Astro);
|
||||
|
||||
import { getCollection } from "astro:content";
|
||||
import EditorialContent from "../../components/EditorialContent.astro";
|
||||
import TOC from "../../components/TOC.astro";
|
||||
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
export async function getStaticPaths({}) {
|
||||
const allPosts = await Astro.glob("../../data/articles/**/*.mdx");
|
||||
|
||||
const localizedPost = allPosts.filter((post) => {
|
||||
return post.frontmatter.lang === astroI18n.langCode;
|
||||
});
|
||||
|
||||
return localizedPost.map((post) => {
|
||||
return {
|
||||
params: { slug: post.frontmatter.slug },
|
||||
props: { post },
|
||||
};
|
||||
export async function getStaticPaths() {
|
||||
const articles = await getCollection("articles", ({ data }) => {
|
||||
return data.lang === astroI18n.langCode;
|
||||
});
|
||||
return articles.map((article) => ({
|
||||
// temp 'split' workaround for i18n
|
||||
params: { slug: article.data.slug },
|
||||
props: { article },
|
||||
}));
|
||||
}
|
||||
|
||||
const { slug } = Astro.params;
|
||||
const { post } = Astro.props;
|
||||
const { article } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
{post.frontmatter.title}
|
||||
<BaseLayout pageTitle={article.data.title}>
|
||||
<EditorialContent content={article} />
|
||||
</BaseLayout>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
import { l, t, astroI18n } from "astro-i18n";
|
||||
astroI18n.init(Astro);
|
||||
|
||||
import "../../styles/style.css";
|
||||
// New astro content collections
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
import ContentPost from "../../components/ContentPost.astro";
|
||||
|
||||
const allPosts = await Astro.glob(`../../data/articles/**/*.mdx`);
|
||||
const localizedPost = allPosts.filter((post) => {
|
||||
return post.frontmatter.lang === astroI18n.langCode;
|
||||
const localizedPost = await getCollection("articles", ({ data }) => {
|
||||
return data.lang === astroI18n.langCode;
|
||||
});
|
||||
|
||||
const pageTitle = t("index.articles.pageName");
|
||||
|
@ -21,8 +22,8 @@ const pageTitle = t("index.articles.pageName");
|
|||
{
|
||||
localizedPost.map((post) => (
|
||||
<li>
|
||||
<a href={l(`/articles/${post.frontmatter.slug}`)}>
|
||||
{post.frontmatter.title}
|
||||
<a href={l("/articles/[slug]", { slug: post.data.slug })}>
|
||||
{post.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
"opensource": "I try to contribute to <a class='u-nice-links' href='https://git.nardu.in/explore/repos' title='Open source projects I worked on (new window)' target='_blank' rel='noreferer noopener'>open source projects</a> that I enjoy.",
|
||||
"writing": "Oh and I write <a class='u-nice-links' href='/en/articles/'>articles!</a> Articles about design and the web in general.",
|
||||
"latestProjects": "Latest projects",
|
||||
"latestArticles": "Latest articles"
|
||||
"latestArticles": "Latest articles",
|
||||
"scihub": "schi-hub-unlock"
|
||||
}
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
"opensource": "J’essaie de contribuer à des <a href='https://git.nardu.in/explore/repos' title='Projets sur lesquels j’ai travaillé (nouvelle fenêtre)' target='_blank' rel='noreferer noopener'>projets open source</a> qui me tiennent à cœur.",
|
||||
"writing": "Ah et j’écris <a href='/articles/'>des articles</a> aussi ! Des articles sur le graphisme et l’informatique.",
|
||||
"latestProjects": "Derniers projets",
|
||||
"latestArticles": "Derniers articles"
|
||||
"latestArticles": "Derniers articles",
|
||||
"scihub": "schi-hub-deblocage"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue