i18n updates + HP + components

This commit is contained in:
Nico 2022-12-22 11:01:52 +01:00
parent 1ab35db47d
commit 23c79e579c
67 changed files with 1355 additions and 542 deletions

View file

@ -0,0 +1,26 @@
---
import { astroI18n } from "astro-i18n";
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 },
};
});
}
const { slug } = Astro.params;
const { post } = Astro.props;
---
<BaseLayout>
{post.frontmatter.title}
</BaseLayout>

View file

@ -1,29 +0,0 @@
---
title: "My First Blog Post"
lang: en
pubDate: 2022-07-01
description: "This is the first post of my new Astro blog."
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
## What I've accomplished
1. **Installing Astro**: First, I created a new Astro project and set up my online accounts.
2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder.
3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts!
## What's next
I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come.

View file

@ -1,17 +0,0 @@
---
title: "Mon premier article"
lang: fr
pubDate: 2022-07-01
description: "youpi"
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Bienvenue les men in black

View file

@ -1,7 +1,4 @@
{
"{route}": "blog",
"pageName": "Blog",
"pageName{cool:'yes'}": "Blog cools",
"pageName{cool:'no'}": "Blog nuls",
"trad": "hello english"
"pageName": "Articles",
"subtitle": "I blog, sometimes."
}

View file

@ -1,6 +1,4 @@
{
"pageName": "Articles",
"pageName{cool:'yes'}": "Articles cools",
"pageName{cool:'no'}": "Articles nuls",
"trad": "slt sava"
"subtitle": "Je blog, un peu."
}

View file

@ -1,29 +1,29 @@
---
import { l, t, astroI18n } from "astro-i18n";
const currentLocale = astroI18n.langCode;
import "../../styles/style.css";
import BaseLayout from "../../layouts/BaseLayout.astro";
import ContentPost from "../../components/ContentPost.astro";
const allPosts = await Astro.glob(`./**/*.mdx`);
const allPosts = await Astro.glob(`../../data/articles/**/*.mdx`);
const localizedPost = allPosts.filter((post) => {
return post.frontmatter.lang === currentLocale;
return post.frontmatter.lang === astroI18n.langCode;
});
const pageTitle = t("index.articles.pageName");
---
<BaseLayout pageTitle={pageTitle}>
<h2>{t("index.articles.pageName", { cool: "yes" }, "fr")}</h2>
<p>{t("index.articles.trad")}</p>
<h2>{t("index.articles.pageName")}</h2>
<p>{t("index.articles.subtitle")}</p>
<ul>
{
localizedPost.map((post) => (
<li>
<ContentPost url={post.url} title={post.frontmatter.title} />
<a href={l(`/articles/${post.frontmatter.slug}`)}>
{post.frontmatter.title}
</a>
</li>
))
}

View file

@ -1,15 +0,0 @@
---
layout: ../../layouts/MarkdownPostLayout.astro
title: My Second Blog Post
author: Astro Learner
description: "After learning some Astro, I couldn't stop!"
image:
url: "/hackerman.png"
alt: "hack"
width: 1920
height: 1080
pubDate: 2022-07-08
tags: ["astro", "blogging", "learning in public", "successes"]
---
After a successful first week learning Astro, I decided to try some more. I wrote and imported a small component from memory!

View file

@ -1,15 +0,0 @@
---
layout: ../../layouts/MarkdownPostLayout.astro
title: Special tag
author: Astro Learner
pubDate: 2022-07-08
tags: ["nicool"]
---
That's it bb
```html
<main>
<header></header>
</main>
```