diff --git a/.gitignore b/.gitignore
index 02f6e50..6691182 100755
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,6 @@ pnpm-debug.log*
# macOS-specific files
.DS_Store
+
+# i18n
+astro_tmp_pages_*
\ No newline at end of file
diff --git a/astro.config.mjs b/astro.config.mjs
index f52259f..f3c1ce1 100755
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -1,8 +1,5 @@
import { defineConfig } from "astro/config";
-// https://github.com/alexandre-fernandez/astro-i18n
-import i18n from "astro-i18n";
-
// https://astro.build/config
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
@@ -10,24 +7,15 @@ import sitemap from "@astrojs/sitemap";
// https://astro.build/config
export default defineConfig({
site: "https://www.nardu.in",
+ build: {
+ format: "directory",
+ },
image: {
domains: ["assets.nardu.in"],
remotePatterns: [{ protocol: "https" }],
},
- markdown: {
- syntaxHighlight: "prism",
- },
integrations: [
- i18n(),
mdx(),
- sitemap({
- i18n: {
- defaultLocale: "fr", // All urls that don't contain `en`
- locales: {
- fr: "fr-FR", // The `defaultLocale` value must present in `locales` keys
- en: "en-US",
- },
- },
- }),
+ sitemap(),
],
});
diff --git a/bun.lockb b/bun.lockb
index bb95c92..6519f63 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index df2307b..960bd98 100755
--- a/package.json
+++ b/package.json
@@ -13,15 +13,14 @@
"i18n:sync": "astro-i18n sync"
},
"dependencies": {
- "@astrojs/mdx": "^1.1.0",
- "@astrojs/rss": "^3.0.0",
- "@astrojs/sitemap": "^3.0.0",
- "astro": "3.1.4",
- "astro-i18n": "1.8.1",
- "sharp": "^0.32.6"
+ "@astrojs/mdx": "4.0.3",
+ "@astrojs/rss": "4.0.10",
+ "@astrojs/sitemap": "3.2.1",
+ "astro": "5.1.1",
+ "sharp": "^0.33.4"
},
"devDependencies": {
- "autoprefixer": "^10.4.13",
- "postcss": "^8.4.20"
+ "autoprefixer": "^10.4.19",
+ "postcss": "^8.4.38"
}
}
diff --git a/src/components/EditorialContent.astro b/src/components/EditorialContent.astro
index f2bd32c..9363412 100755
--- a/src/components/EditorialContent.astro
+++ b/src/components/EditorialContent.astro
@@ -1,11 +1,11 @@
---
-// import { renderContent } from "astro-i18n";
+import { render } from "astro:content";
+
import MetaDate from "./MetaDate.astro";
import TOC from "./TOC.astro";
const { content } = Astro.props;
-const { Content, headings } = await content.render();
-// const { html, headings } = await renderContent(Astro, content);
+const { Content, headings } = await render(content);
const toc = headings.map((heading) => {
return heading;
diff --git a/src/content/config.ts b/src/content.config.ts
similarity index 86%
rename from src/content/config.ts
rename to src/content.config.ts
index d300ed6..91f8389 100755
--- a/src/content/config.ts
+++ b/src/content.config.ts
@@ -1,6 +1,8 @@
import { z, defineCollection } from "astro:content";
+import { glob } from 'astro/loaders';
const articles = defineCollection({
+ loader: glob({ pattern: '**/[^_]*.md', base: "./src/content/articles" }),
schema: z.object({
title: z.string(),
subtitle: z.string(),
@@ -20,6 +22,7 @@ const articles = defineCollection({
});
const fragments = defineCollection({
+ loader: glob({ pattern: '**/[^_]*.md', base: "./src/content/fragments" }),
schema: z.object({
title: z.string(),
subtitle: z.string(),
@@ -39,6 +42,7 @@ const fragments = defineCollection({
});
const references = defineCollection({
+ loader: glob({ pattern: '**/[^_]*.md', base: "./src/content/references" }),
schema: z.object({
title: z.string(),
subtitle: z.string(),
diff --git a/src/pages/articles/[slug].astro b/src/pages/articles/[id].astro
similarity index 95%
rename from src/pages/articles/[slug].astro
rename to src/pages/articles/[id].astro
index 3205fc1..3afee5d 100755
--- a/src/pages/articles/[slug].astro
+++ b/src/pages/articles/[id].astro
@@ -13,7 +13,7 @@ export const getStaticPaths = createStaticPaths(
return data.lang === langCode;
});
return articles.map((article) => ({
- params: { slug: article.data.permalink },
+ params: { id: article.data.permalink },
props: { article },
}));
},
diff --git a/src/pages/en/articles/[slug].astro b/src/pages/en/articles/[slug].astro
deleted file mode 100755
index e3ae02e..0000000
--- a/src/pages/en/articles/[slug].astro
+++ /dev/null
@@ -1,15 +0,0 @@
----
-import Page from "../../articles/[slug].astro"
-import { getStaticPaths as proxyGetStaticPaths } from "../../articles/[slug].astro"
-import { extractRouteLangCode } from "astro-i18n"
-
-/* @ts-ignore */
-export const getStaticPaths = (props) => proxyGetStaticPaths({
- ...props,
- langCode: extractRouteLangCode(import.meta.url),
-})
-
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/articles/index.astro b/src/pages/en/articles/index.astro
deleted file mode 100755
index c0884db..0000000
--- a/src/pages/en/articles/index.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../../articles/index.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/index.astro b/src/pages/en/index.astro
deleted file mode 100755
index 6dbe9cb..0000000
--- a/src/pages/en/index.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../index.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/sitemap.astro b/src/pages/en/sitemap.astro
deleted file mode 100755
index ce341ca..0000000
--- a/src/pages/en/sitemap.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../plan-du-site.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/snippets/[slug].astro b/src/pages/en/snippets/[slug].astro
deleted file mode 100755
index edfda1f..0000000
--- a/src/pages/en/snippets/[slug].astro
+++ /dev/null
@@ -1,15 +0,0 @@
----
-import Page from "../../fragments/[slug].astro"
-import { getStaticPaths as proxyGetStaticPaths } from "../../fragments/[slug].astro"
-import { extractRouteLangCode } from "astro-i18n"
-
-/* @ts-ignore */
-export const getStaticPaths = (props) => proxyGetStaticPaths({
- ...props,
- langCode: extractRouteLangCode(import.meta.url),
-})
-
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/snippets/index.astro b/src/pages/en/snippets/index.astro
deleted file mode 100755
index f2672a4..0000000
--- a/src/pages/en/snippets/index.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../../fragments/index.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/veille/index.astro b/src/pages/en/veille/index.astro
deleted file mode 100755
index a2676da..0000000
--- a/src/pages/en/veille/index.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../../veille/index.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/en/work/index.astro b/src/pages/en/work/index.astro
deleted file mode 100755
index 3e3654b..0000000
--- a/src/pages/en/work/index.astro
+++ /dev/null
@@ -1,6 +0,0 @@
----
-import Page from "../../references/index.astro"
-const { props } = Astro
----
-
-
\ No newline at end of file
diff --git a/src/pages/fragments/[slug].astro b/src/pages/fragments/[id].astro
similarity index 95%
rename from src/pages/fragments/[slug].astro
rename to src/pages/fragments/[id].astro
index c8935d3..c3a67bf 100755
--- a/src/pages/fragments/[slug].astro
+++ b/src/pages/fragments/[id].astro
@@ -13,7 +13,7 @@ export const getStaticPaths = createStaticPaths(
return data.lang === langCode;
});
return snippets.map((snippet) => ({
- params: { slug: snippet.data.permalink },
+ params: { id: snippet.data.permalink },
props: { snippet },
}));
},
diff --git a/src/pages/index.astro b/src/pages/index.astro
index bae2acc..7382c51 100755
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -1,7 +1,8 @@
---
// init i18n
-import { l, t, astroI18n } from "astro-i18n";
-astroI18n.init(Astro);
+import { getLocale } from "astro-i18n-aut";
+
+const locale = getLocale(Astro.url);
// import stuff
import BaseLayout from "../layouts/BaseLayout.astro";
@@ -11,17 +12,19 @@ import ListCards from "../components/ListCards.astro";
const pageTitle = t("accueil");
// get all HP sections
-const allSections = await Astro.glob("../data/HP/**/*.md");
+const allSections = Object.values(
+ import.meta.glob("../data/HP/**/*.md", { eager: true })
+);
// only keep the right locale version
const localizedSections = allSections.filter((section) => {
- return section.frontmatter.lang === astroI18n.langCode;
+ return section.frontmatter.lang === locale;
});
// New astro content collections
import { getCollection } from "astro:content";
// Only return posts with correct lang in the frontmatter
const localizedArticles = await getCollection("articles", ({ data }) => {
- return data.lang === astroI18n.langCode && !data.draft;
+ return data.lang === locale && !data.draft;
});
// sort articles by descending publication date
const sortedArticles = localizedArticles.sort(
@@ -29,14 +32,14 @@ const sortedArticles = localizedArticles.sort(
);
// Only return snippets with correct lang in the frontmatter
const localizedSnippets = await getCollection("fragments", ({ data }) => {
- return data.lang === astroI18n.langCode && !data.draft;
+ return data.lang === locale && !data.draft;
});
// sort articles by descending publication date
const sortedSnippets = localizedSnippets.sort(
(a, b) => b.data.createdAt - a.data.createdAt
);
const localizedReferences = await getCollection("references", ({ data }) => {
- return data.lang === astroI18n.langCode && !data.draft;
+ return data.lang === locale && !data.draft;
});
---
diff --git a/src/pages/veille/index.astro b/src/pages/veille/index.astro
index b30db14..02dd5c3 100755
--- a/src/pages/veille/index.astro
+++ b/src/pages/veille/index.astro
@@ -8,7 +8,9 @@ import BaseLayout from "../../layouts/BaseLayout.astro";
import MetaDate from "../../components/MetaDate.astro";
// get all content
-const allSections = await Astro.glob("../../data/veille/**/*.md");
+const allSections = Object.values(
+ import.meta.glob("../../data/veille/**/*.md", { eager: true })
+);
// only keep the right locale version
const localizedSections = allSections.filter((section) => {
return section.frontmatter.lang === astroI18n.langCode;
diff --git a/tsconfig.json b/tsconfig.json
index e5993f9..e71eb5a 100755
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,5 +1,7 @@
{
"extends": "astro/tsconfigs/base",
+ "include": [".astro/types.d.ts", "**/*"],
+ "exclude": ["dist"],
"compilerOptions": {
"strictNullChecks": true
}