Compare commits
No commits in common. "66c391a5de5de08aed966c5d768aa7bc33b546c8" and "73d4d2fa064b876b050d059095ce3c9ca3ae8092" have entirely different histories.
66c391a5de
...
73d4d2fa06
9 changed files with 1340 additions and 1725 deletions
|
|
@ -6,12 +6,6 @@ import tailwind from "@astrojs/tailwind";
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
devToolbar: { enabled: false },
|
devToolbar: { enabled: false },
|
||||||
integrations: [tailwind()],
|
integrations: [tailwind()],
|
||||||
redirects: {
|
|
||||||
"/photos": {
|
|
||||||
status: 301,
|
|
||||||
destination: "https://photos.jalil.arfaoui.net"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: "fr",
|
defaultLocale: "fr",
|
||||||
locales: ["fr", "en", "ar"],
|
locales: ["fr", "en", "ar"],
|
||||||
|
|
|
||||||
2982
package-lock.json
generated
2982
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -13,12 +13,12 @@
|
||||||
"check": "biome check --apply-unsafe ."
|
"check": "biome check --apply-unsafe ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/check": "^0.9.6",
|
"@astrojs/check": "^0.9.4",
|
||||||
"@astrojs/tailwind": "^6.0.2",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@biomejs/biome": "1.7.3",
|
"@biomejs/biome": "1.7.3",
|
||||||
"@tailwindcss/typography": "^0.5.13",
|
"@tailwindcss/typography": "^0.5.13",
|
||||||
"@types/node": "^25.0.3",
|
"@types/node": "^25.0.3",
|
||||||
"astro": "^5.17.2",
|
"astro": "^4.8.2",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"tailwindcss": "^3.4.3",
|
"tailwindcss": "^3.4.3",
|
||||||
"tsx": "^4.21.0",
|
"tsx": "^4.21.0",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import CategoryNav from '../CategoryNav.astro';
|
||||||
import AlbumHeader from '../AlbumHeader.astro';
|
import AlbumHeader from '../AlbumHeader.astro';
|
||||||
import MasonryGallery from '../MasonryGallery.astro';
|
import MasonryGallery from '../MasonryGallery.astro';
|
||||||
import Lightbox from '../Lightbox.astro';
|
import Lightbox from '../Lightbox.astro';
|
||||||
import { render } from 'astro:content';
|
|
||||||
import { getPostBaseSlug, type Locale } from '../../../utils/i18n';
|
import { getPostBaseSlug, type Locale } from '../../../utils/i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -17,7 +16,7 @@ const { post, lang = 'fr' } = Astro.props;
|
||||||
// Importer toutes les images du dossier photos
|
// Importer toutes les images du dossier photos
|
||||||
const allImages = import.meta.glob<{ default: ImageMetadata }>('/src/assets/images/photos/blog/**/*.{jpg,jpeg,png,webp}');
|
const allImages = import.meta.glob<{ default: ImageMetadata }>('/src/assets/images/photos/blog/**/*.{jpg,jpeg,png,webp}');
|
||||||
|
|
||||||
const { Content } = await render(post);
|
const { Content } = await post.render();
|
||||||
|
|
||||||
const baseSlug = getPostBaseSlug(post.id);
|
const baseSlug = getPostBaseSlug(post.id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const { count } = Astro.props;
|
||||||
const postsLoop = allPosts.slice(0, count).map((post) => {
|
const postsLoop = allPosts.slice(0, count).map((post) => {
|
||||||
return {
|
return {
|
||||||
...(post.data || {}),
|
...(post.data || {}),
|
||||||
link: `/post/${post.id}`,
|
link: `/post/${post.slug}`,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,4 @@
|
||||||
import { defineCollection, z } from "astro:content";
|
import { defineCollection, z } from "astro:content";
|
||||||
import { glob } from "astro/loaders";
|
|
||||||
|
|
||||||
/** Préserve les points dans les IDs (ex: "portraits.en.json" → "portraits.en") */
|
|
||||||
const stripExtension = (ext: string) =>
|
|
||||||
({ generateId: ({ entry }: { entry: string }) => entry.replace(new RegExp(`\\.${ext}$`), '') });
|
|
||||||
|
|
||||||
const formatDate = (date: Date, lang: string = 'fr') => {
|
const formatDate = (date: Date, lang: string = 'fr') => {
|
||||||
const locales: Record<string, string> = { fr: 'fr-FR', en: 'en-US', ar: 'ar-SA' };
|
const locales: Record<string, string> = { fr: 'fr-FR', en: 'en-US', ar: 'ar-SA' };
|
||||||
|
|
@ -15,7 +10,7 @@ const formatDate = (date: Date, lang: string = 'fr') => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const blogCollection = defineCollection({
|
const blogCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }),
|
type: "content",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
@ -33,7 +28,7 @@ const blogCollection = defineCollection({
|
||||||
});
|
});
|
||||||
|
|
||||||
const projectsCollection = defineCollection({
|
const projectsCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.md", base: "./src/content/projects" }),
|
type: "content",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
@ -52,7 +47,7 @@ const projectsCollection = defineCollection({
|
||||||
});
|
});
|
||||||
|
|
||||||
const talksCollection = defineCollection({
|
const talksCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.md", base: "./src/content/talks" }),
|
type: "content",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
@ -71,7 +66,7 @@ const talksCollection = defineCollection({
|
||||||
});
|
});
|
||||||
|
|
||||||
const photoBlogPostsCollection = defineCollection({
|
const photoBlogPostsCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.md", base: "./src/content/photoBlogPosts", ...stripExtension('md') }),
|
type: "content",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
@ -85,7 +80,7 @@ const photoBlogPostsCollection = defineCollection({
|
||||||
});
|
});
|
||||||
|
|
||||||
const photoCategoriesCollection = defineCollection({
|
const photoCategoriesCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.json", base: "./src/content/photoCategories", ...stripExtension('json') }),
|
type: "data",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
subtitle: z.string(),
|
subtitle: z.string(),
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
---
|
|
||||||
import Layout from "../layouts/main.astro";
|
|
||||||
---
|
|
||||||
|
|
||||||
<Layout title="404">
|
|
||||||
<div class="relative z-20 flex flex-col items-center justify-center w-full max-w-2xl mx-auto px-7 mt-16 mb-16 md:mt-24 lg:mt-32 text-center min-h-[50vh]">
|
|
||||||
<h1 class="text-8xl md:text-9xl font-bold text-neutral-200 dark:text-neutral-800 select-none">
|
|
||||||
404
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<p id="message" class="mt-6 text-xl text-neutral-600 dark:text-neutral-400">
|
|
||||||
Cette page n'existe pas.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<a id="home-link" href="/" class="mt-8 inline-flex items-center px-6 py-3 text-sm font-semibold text-white bg-blue-600 rounded-full hover:bg-blue-700 transition-colors duration-200">
|
|
||||||
Retour à l'accueil
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
|
|
||||||
<script is:inline>
|
|
||||||
(function () {
|
|
||||||
var path = window.location.pathname;
|
|
||||||
var msg = document.getElementById('message');
|
|
||||||
var link = document.getElementById('home-link');
|
|
||||||
|
|
||||||
if (path.startsWith('/en')) {
|
|
||||||
msg.textContent = 'This page does not exist.';
|
|
||||||
link.textContent = 'Back to home';
|
|
||||||
link.href = '/en';
|
|
||||||
} else if (path.startsWith('/ar')) {
|
|
||||||
msg.textContent = 'هذه الصفحة غير موجودة.';
|
|
||||||
link.textContent = 'العودة إلى الصفحة الرئيسية';
|
|
||||||
link.href = '/ar';
|
|
||||||
msg.dir = 'rtl';
|
|
||||||
link.dir = 'rtl';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
---
|
---
|
||||||
import { getCollection, render } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const postEntries = await getCollection("blog");
|
const postEntries = await getCollection("blog");
|
||||||
return postEntries.map((entry) => ({
|
return postEntries.map((entry) => ({
|
||||||
params: { slug: entry.id },
|
params: { slug: entry.slug },
|
||||||
props: { entry },
|
props: { entry },
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { entry } = Astro.props;
|
const { entry } = Astro.props;
|
||||||
const { Content } = await render(entry);
|
const { Content } = await entry.render();
|
||||||
---
|
---
|
||||||
|
|
||||||
<Content />
|
<Content />
|
||||||
|
|
@ -170,7 +170,7 @@ export function getHomePath(locale: Locale): string {
|
||||||
return locale === 'fr' ? '/' : `/${locale}`;
|
return locale === 'fr' ? '/' : `/${locale}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Slug de base d'un photo blog post depuis son id (ex: "2015/enigma.en" → "enigma") */
|
/** Slug de base d'un photo blog post depuis son id (ex: "2015/enigma.en.md" → "enigma") */
|
||||||
export function getPostBaseSlug(postId: string): string {
|
export function getPostBaseSlug(postId: string): string {
|
||||||
return postId.replace(/^\d{4}\//, '').replace(/\.(en|ar)(\.md)?$/, '');
|
return postId.replace(/^\d{4}\//, '').replace(/\.(en|ar)?\.mdx?$/, '');
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue