diff --git a/.astro-i18n/generated.d.ts b/.astro-i18n/generated.d.ts index d7cf54a..1750f79 100644 --- a/.astro-i18n/generated.d.ts +++ b/.astro-i18n/generated.d.ts @@ -11,9 +11,11 @@ declare module "astro-i18n" { export function l( route: Uri | string & {}, - ...args: keyof RouteParams extends Uri - ? [params?: Record, targetLangCode?: LangCode, routeLangCode?: LangCode] - : [params: RouteParams[Uri], targetLangCode?: LangCode, routeLangCode?: LangCode] + ...args: Uri extends keyof RouteParams + ? undefined extends RouteParams[Uri] + ? [params?: Record, targetLangCode?: LangCode, routeLangCode?: LangCode] + : [params: RouteParams[Uri], targetLangCode?: LangCode, routeLangCode?: LangCode] + : [params?: Record, targetLangCode?: LangCode, routeLangCode?: LangCode] ): string export function t( diff --git a/package.json b/package.json index a35a07e..eba5008 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "dependencies": { "@astrojs/image": "^0.16.7", "@astrojs/mdx": "^0.19.1", + "@astrojs/rss": "^2.4.1", "@astrojs/sitemap": "^1.3.0", "astro": "2.4.3", "astro-i18n": "^1.6.10" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8375bdf..b58c56e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,9 @@ dependencies: '@astrojs/mdx': specifier: ^0.19.1 version: 0.19.1(astro@2.4.3)(rollup@3.21.5) + '@astrojs/rss': + specifier: ^2.4.1 + version: 2.4.1 '@astrojs/sitemap': specifier: ^1.3.0 version: 1.3.0 @@ -138,6 +141,13 @@ packages: prismjs: 1.29.0 dev: false + /@astrojs/rss@2.4.1: + resolution: {integrity: sha512-c+j6Dwxc/t50/v7xhM88RKbxh9SjaQMw0IdLeeOqQAdcLT2Me7nUUWwx0BbPnu6RO0YxT5Up1Sl/OdrA60tfSw==} + dependencies: + fast-xml-parser: 4.2.2 + kleur: 4.1.5 + dev: false + /@astrojs/sitemap@1.3.0: resolution: {integrity: sha512-s1/v9MfnxVLvH5v4edK02bBAOMp5tuEvhPT1pJ2qaqXM6QZuqatk/xQU3kuWebQh+yqnD2yBeeHbmfwr4gG1vw==} dependencies: @@ -1777,6 +1787,13 @@ packages: micromatch: 4.0.5 dev: false + /fast-xml-parser@4.2.2: + resolution: {integrity: sha512-DLzIPtQqmvmdq3VUKR7T6omPK/VCRNqgFlGtbESfyhcH2R4I8EzK1/K6E8PkRCK2EabWrUHK32NjYRbEFnnz0Q==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: false + /fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: @@ -3540,6 +3557,10 @@ packages: engines: {node: '>=12'} dev: false + /strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + dev: false + /style-to-object@0.4.1: resolution: {integrity: sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==} dependencies: diff --git a/src/content/articles/en/2022.md b/src/content/articles/en/2022.md index 5603588..8690c06 100644 --- a/src/content/articles/en/2022.md +++ b/src/content/articles/en/2022.md @@ -5,6 +5,7 @@ lang: en slug: "2022" excerpt: Changes in my services, the website and myself. tags: ["Freelance"] +type: articles createdAt: "2022-06-08T14:24:06.000Z" --- diff --git a/src/content/articles/en/2023.md b/src/content/articles/en/2023.md index 418d74e..ac1d1f3 100644 --- a/src/content/articles/en/2023.md +++ b/src/content/articles/en/2023.md @@ -5,6 +5,7 @@ lang: en slug: "2023" excerpt: New changes. tags: ["Freelance"] +type: articles createdAt: "2023-02-03T17:41:00.000Z" --- diff --git a/src/content/articles/en/after-effects-expressions.mdx b/src/content/articles/en/after-effects-expressions.mdx index 3552f4b..8bde8ca 100644 --- a/src/content/articles/en/after-effects-expressions.mdx +++ b/src/content/articles/en/after-effects-expressions.mdx @@ -5,6 +5,7 @@ lang: en slug: "after-effects-expressions" excerpt: Expressions in After Effects have always been blurry for me. I know they exist, I know they're powerful, I know it could save a lot of time and clean complex keyframe filled compositions but… They are hard to learn! tags: ["Design"] +type: articles createdAt: "2019-04-24T09:00:00.000Z" code: true --- diff --git a/src/content/articles/en/faq.md b/src/content/articles/en/faq.md index 6a058a4..c353513 100644 --- a/src/content/articles/en/faq.md +++ b/src/content/articles/en/faq.md @@ -6,6 +6,7 @@ slug: "faq" draft: true excerpt: Why, how et and especially what. tags: ["Freelance"] +type: articles createdAt: "2022-06-22T15:34:45.000Z" --- diff --git a/src/content/articles/en/gratuiste.md b/src/content/articles/en/gratuiste.md index 61691c3..ca37270 100644 --- a/src/content/articles/en/gratuiste.md +++ b/src/content/articles/en/gratuiste.md @@ -6,6 +6,7 @@ slug: "gratuiste" draft: true excerpt: Translation in progress, stay tuned ;) tags: ["Design", "Freelance"] +type: articles createdAt: "2017-05-27T07:47:36.000Z" --- diff --git a/src/content/articles/en/sci-hub-blocage.mdx b/src/content/articles/en/sci-hub-blocage.mdx index b65675a..fd1a5d4 100644 --- a/src/content/articles/en/sci-hub-blocage.mdx +++ b/src/content/articles/en/sci-hub-blocage.mdx @@ -6,6 +6,7 @@ slug: "sci-hub-unblock" key: "scihub" excerpt: "In March 2019, the Paris Regional Court ruled in favour of the publishers of scientific articles Elsevier and Springer Nature by ordering internet service providers to block access to these two websites. Here is how to access them if they are blocked in your country anyway." tags: ["Internet", "Science"] +type: articles createdAt: "2019-03-31T07:47:36.000Z" updatedAt: "2022-12-27T12:08:00.000Z" --- diff --git a/src/content/articles/en/the-day-I-jamd.mdx b/src/content/articles/en/the-day-I-jamd.mdx index 5e3d172..3366ca5 100644 --- a/src/content/articles/en/the-day-I-jamd.mdx +++ b/src/content/articles/en/the-day-I-jamd.mdx @@ -5,6 +5,7 @@ lang: en slug: "the-day-I-jamd" excerpt: Ooh, yeah! All right! We’re jammin’ tags: ["Dev", "Jamstack"] +type: articles createdAt: "2020-10-08T09:00:00.000Z" updatedAt: "2022-12-27T15:40:06.000Z" --- diff --git a/src/content/articles/en/video-compression.mdx b/src/content/articles/en/video-compression.mdx index c9d7b51..bd154dc 100644 --- a/src/content/articles/en/video-compression.mdx +++ b/src/content/articles/en/video-compression.mdx @@ -5,6 +5,7 @@ lang: en slug: "video-compression" excerpt: How to gain precious weight when encoding videos. tags: ["Design"] +type: articles createdAt: "2021-05-05T09:00:00.000Z" updatedAt: "2022-06-08T14:24:06.000Z" --- diff --git a/src/content/articles/fr/2022.md b/src/content/articles/fr/2022.md index 46e0427..09e9d24 100644 --- a/src/content/articles/fr/2022.md +++ b/src/content/articles/fr/2022.md @@ -5,6 +5,7 @@ lang: fr slug: "2022" excerpt: Évolution des services, du site et de moi-même. tags: ["Freelance"] +type: articles createdAt: "2022-06-08T14:24:06.000Z" --- diff --git a/src/content/articles/fr/2023.md b/src/content/articles/fr/2023.md index a5aba0d..e30547a 100644 --- a/src/content/articles/fr/2023.md +++ b/src/content/articles/fr/2023.md @@ -5,6 +5,7 @@ lang: fr slug: "2023" excerpt: Suite des évolutions. tags: ["Freelance"] +type: articles createdAt: "2023-02-03T17:41:00.000Z" --- diff --git a/src/content/articles/fr/after-effects-expressions.md b/src/content/articles/fr/after-effects-expressions.md index 0012108..e449ab1 100644 --- a/src/content/articles/fr/after-effects-expressions.md +++ b/src/content/articles/fr/after-effects-expressions.md @@ -6,6 +6,7 @@ draft: true slug: "after-effects-expressions" excerpt: En cours de traduction, revenez bientôt ;) tags: ["Design"] +type: articles createdAt: "2019-04-24T09:00:00.000Z" --- diff --git a/src/content/articles/fr/faq.md b/src/content/articles/fr/faq.md index 52af993..4c3e3f0 100644 --- a/src/content/articles/fr/faq.md +++ b/src/content/articles/fr/faq.md @@ -5,6 +5,7 @@ lang: fr slug: "faq" excerpt: Pourquoi, comment et surtout quèsaco. tags: ["Freelance"] +type: articles createdAt: "2022-06-22T15:34:45.000Z" --- diff --git a/src/content/articles/fr/gratuiste.md b/src/content/articles/fr/gratuiste.md index 84cc1b6..d4ba512 100644 --- a/src/content/articles/fr/gratuiste.md +++ b/src/content/articles/fr/gratuiste.md @@ -5,6 +5,7 @@ lang: fr slug: "gratuiste" excerpt: "J’ai cherché un moyen de mettre mes compétences au service d’autrui et je pense avoir trouvé: je vais travailler gratuitement pour des associations." tags: ["Graphisme", "Freelance"] +type: articles createdAt: "2017-05-27T07:47:36.000Z" updatedAt: "2022-12-27T15:36:06.000Z" --- diff --git a/src/content/articles/fr/sci-hub-blocage.mdx b/src/content/articles/fr/sci-hub-blocage.mdx index 7ad90f5..0e5325e 100644 --- a/src/content/articles/fr/sci-hub-blocage.mdx +++ b/src/content/articles/fr/sci-hub-blocage.mdx @@ -5,6 +5,7 @@ lang: fr slug: "sci-hub-blocage" excerpt: "Le tribunal de grande instance de Paris a ordonné aux fournisseurs d’accès à internet de bloquer l’accès à sci-hub. Voici comment contourner les blocages mis en place." tags: ["Internet", "Science"] +type: articles createdAt: "2019-03-31T07:47:36.000Z" updatedAt: "2022-12-27T12:08:00.000Z" --- diff --git a/src/content/articles/fr/the-day-I-jamd.mdx b/src/content/articles/fr/the-day-I-jamd.mdx index c7aa783..1990cb3 100644 --- a/src/content/articles/fr/the-day-I-jamd.mdx +++ b/src/content/articles/fr/the-day-I-jamd.mdx @@ -5,6 +5,7 @@ lang: fr slug: "the-day-I-jamd" excerpt: Ooh, yeah! All right! We’re jammin’ tags: ["Dev", "Jamstack"] +type: articles createdAt: "2020-10-08T07:47:36.000Z" updatedAt: "2022-12-27T15:40:06.000Z" --- diff --git a/src/content/articles/fr/video-compression.md b/src/content/articles/fr/video-compression.md index 7c34cdf..fd70eaf 100644 --- a/src/content/articles/fr/video-compression.md +++ b/src/content/articles/fr/video-compression.md @@ -6,6 +6,7 @@ draft: true slug: "video-compression" excerpt: Pas encore traduit tags: ["Design"] +type: articles createdAt: "2021-05-05T09:00:00.000Z" updatedAt: "2022-06-08T14:24:06.000Z" --- diff --git a/src/content/config.ts b/src/content/config.ts index b2cd461..e7e5708 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -6,6 +6,7 @@ const articles = defineCollection({ subtitle: z.string(), lang: z.enum(["fr", "en"]), tags: z.array(z.string()), // An array of strings + type: z.string(), // Parse pubDate as a browser-standard `Date` object createdAt: z.string().transform((str) => new Date(str)), updatedAt: z @@ -23,6 +24,7 @@ const fragments = defineCollection({ subtitle: z.string(), lang: z.enum(["fr", "en"]), tags: z.array(z.string()), // An array of strings + type: z.string(), // Parse pubDate as a browser-standard `Date` object createdAt: z.string().transform((str) => new Date(str)), updatedAt: z diff --git a/src/content/fragments/en/acme-sh-tls-cert.md b/src/content/fragments/en/acme-sh-tls-cert.md index 359c5b1..9f0a6c2 100644 --- a/src/content/fragments/en/acme-sh-tls-cert.md +++ b/src/content/fragments/en/acme-sh-tls-cert.md @@ -6,6 +6,7 @@ slug: "acme-sh-tls-cert" createdAt: "2022-06-08T14:24:06.000Z" excerpt: Real cert have curves. tags: ["security"] +type: snippets --- ## Disclaimer diff --git a/src/content/fragments/en/array-vs-array.md b/src/content/fragments/en/array-vs-array.md index 7f303a4..b93ee61 100644 --- a/src/content/fragments/en/array-vs-array.md +++ b/src/content/fragments/en/array-vs-array.md @@ -6,6 +6,7 @@ slug: "array-vs-array" createdAt: "2022-06-08T14:24:06.000Z" excerpt: My peak javascript tags: ["nuxt.js"] +type: snippets --- ## Context diff --git a/src/content/fragments/en/buttons.md b/src/content/fragments/en/buttons.md index dc7f25b..a450e18 100644 --- a/src/content/fragments/en/buttons.md +++ b/src/content/fragments/en/buttons.md @@ -7,6 +7,7 @@ draft: true excerpt: Easy to grab and use hover effects. tags: ["CSS"] code: true +type: snippets createdAt: "2020-10-08T09:00:00.000Z" --- diff --git a/src/content/fragments/en/image-full.mdx b/src/content/fragments/en/image-full.mdx index 440d7e3..00ec278 100644 --- a/src/content/fragments/en/image-full.mdx +++ b/src/content/fragments/en/image-full.mdx @@ -7,6 +7,7 @@ slug: "image-full" createdAt: "2020-09-15T09:00:00.000Z" updatedAt: "2022-06-08T14:24:06.000Z" tags: ["CSS"] +type: snippets --- [Go back to available snippets](/en/snippets) diff --git a/src/content/fragments/en/nuxt-graphql-static.md b/src/content/fragments/en/nuxt-graphql-static.md index 5676ded..4b933e4 100644 --- a/src/content/fragments/en/nuxt-graphql-static.md +++ b/src/content/fragments/en/nuxt-graphql-static.md @@ -7,6 +7,7 @@ createdAt: "2022-06-08T14:24:06.000Z" updatedAt: "2022-09-08T13:43:33.000Z" excerpt: When the most used gql module doesn't work… tags: ["nuxt.js"] +type: snippets --- ## The problem diff --git a/src/content/fragments/en/super-cookies.md b/src/content/fragments/en/super-cookies.md index 53ca4c2..e26f7e4 100644 --- a/src/content/fragments/en/super-cookies.md +++ b/src/content/fragments/en/super-cookies.md @@ -6,6 +6,7 @@ slug: "super-cookies" createdAt: "2022-06-08T14:24:06.000Z" excerpt: It's a real recipe, not a joke about annoying files. tags: ["food"] +type: snippets --- import AstroImage from "../../../components/AstroImage.astro"; diff --git a/src/content/fragments/en/toulouse-fun.md b/src/content/fragments/en/toulouse-fun.md index 0c39941..45691ba 100644 --- a/src/content/fragments/en/toulouse-fun.md +++ b/src/content/fragments/en/toulouse-fun.md @@ -5,6 +5,7 @@ lang: en slug: "toulouse-fun" excerpt: Gonna have to trust me on this ¯\_(ツ)_/¯ tags: ["lifestyle"] +type: snippets createdAt: "2022-06-22T15:34:45.000Z" --- diff --git a/src/content/fragments/fr/acme-sh-tls-cert.md b/src/content/fragments/fr/acme-sh-tls-cert.md index 70c8f84..2601bf6 100644 --- a/src/content/fragments/fr/acme-sh-tls-cert.md +++ b/src/content/fragments/fr/acme-sh-tls-cert.md @@ -6,6 +6,7 @@ slug: "acme-sh-tls-cert" createdAt: "2022-06-08T14:24:06.000Z" excerpt: La sécurité avec des courbes. tags: ["sécurité"] +type: fragments --- ## Attention diff --git a/src/content/fragments/fr/array-vs-array.md b/src/content/fragments/fr/array-vs-array.md index e5dc370..51155c4 100644 --- a/src/content/fragments/fr/array-vs-array.md +++ b/src/content/fragments/fr/array-vs-array.md @@ -7,6 +7,7 @@ slug: "array-vs-array" createdAt: "2022-06-08T14:24:06.000Z" excerpt: En cours de traduction. tags: ["nuxt.js"] +type: fragments --- [Voir les fragments disponibles](/fragments) diff --git a/src/content/fragments/fr/buttons.mdx b/src/content/fragments/fr/buttons.mdx index 1f0d69e..360c58b 100644 --- a/src/content/fragments/fr/buttons.mdx +++ b/src/content/fragments/fr/buttons.mdx @@ -6,6 +6,7 @@ slug: "buttons" draft: true excerpt: Quelques effets de survol faciles à récupérer et utiliser. tags: ["CSS"] +type: fragments code: true createdAt: "2020-10-08T09:00:00.000Z" --- diff --git a/src/content/fragments/fr/image-full.mdx b/src/content/fragments/fr/image-full.mdx index 753bf5b..52b4a3a 100644 --- a/src/content/fragments/fr/image-full.mdx +++ b/src/content/fragments/fr/image-full.mdx @@ -7,6 +7,7 @@ createdAt: "2020-09-15T09:00:00.000Z" updatedAt: "2022-06-08T14:24:06.000Z" excerpt: Faire déborder une image de son conteneur sans tout casser. tags: ["CSS"] +type: fragments --- import AstroImage from "../../../components/AstroImage.astro"; diff --git a/src/content/fragments/fr/nuxt-graphql-static.md b/src/content/fragments/fr/nuxt-graphql-static.md index d943c06..459ccc8 100644 --- a/src/content/fragments/fr/nuxt-graphql-static.md +++ b/src/content/fragments/fr/nuxt-graphql-static.md @@ -7,6 +7,7 @@ createdAt: "2022-06-08T14:24:06.000Z" updatedAt: "2022-09-08T13:43:33.000Z" excerpt: Quand le module gql le plus utilisé ne fonctionne pas… tags: ["nuxt.js"] +type: fragments --- ## Le problème diff --git a/src/content/fragments/fr/super-cookies.mdx b/src/content/fragments/fr/super-cookies.mdx index da7e0ca..abb5d37 100644 --- a/src/content/fragments/fr/super-cookies.mdx +++ b/src/content/fragments/fr/super-cookies.mdx @@ -6,6 +6,7 @@ slug: "super-cookies" createdAt: "2022-06-08T14:24:06.000Z" excerpt: C'est vraiment une recette hein, pas une blague sur les fichiers temporaires. tags: ["cuisine"] +type: fragments --- import AstroImage from "../../../components/AstroImage.astro"; diff --git a/src/content/fragments/fr/toulouse-fun.md b/src/content/fragments/fr/toulouse-fun.md index 817f344..0401177 100644 --- a/src/content/fragments/fr/toulouse-fun.md +++ b/src/content/fragments/fr/toulouse-fun.md @@ -7,6 +7,7 @@ slug: "toulouse-fun" createdAt: "2022-06-22T15:34:45.000Z" excerpt: En cours de traduction. tags: ["lifestyle"] +type: fragments --- [Voir les fragments disponibles](/fragments) diff --git a/src/pages/en/rss.xml.js b/src/pages/en/rss.xml.js new file mode 100644 index 0000000..21ab665 --- /dev/null +++ b/src/pages/en/rss.xml.js @@ -0,0 +1,34 @@ +import rss from "@astrojs/rss"; +import { getCollection } from "astro:content"; + +export async function get(context) { + const articles = await getCollection("articles", ({ data }) => { + return data.lang === "en" && !data.draft; + }); + const fragments = await getCollection("fragments", ({ data }) => { + return data.lang === "en" && !data.draft; + }); + const posts = articles.concat(fragments); + return rss({ + // `` field in output xml + title: "Nicolas Arduin", + // `<description>` field in output xml + description: "Articles from nardu.in", + // Pull in your project "site" from the endpoint context + // https://docs.astro.build/en/reference/api-reference/#contextsite + site: context.site, + // Array of `<item>`s in output xml + // See "Generating items" section for examples using content collections and glob imports + items: posts.map((post) => ({ + title: post.data.title, + pubDate: post.data.createdAt, + description: post.data.subtitle, + lang: post.data.lang, + // Compute RSS link from post `slug` + // This example assumes all posts are rendered as `/blog/[slug]` routes + link: `/en/${post.data.type}/${post.slug}/`, + })), + // (optional) inject custom xml + customData: `<language>en-us</language>`, + }); +} diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js new file mode 100644 index 0000000..969b32c --- /dev/null +++ b/src/pages/rss.xml.js @@ -0,0 +1,34 @@ +import rss from "@astrojs/rss"; +import { getCollection } from "astro:content"; + +export async function get(context) { + const articles = await getCollection("articles", ({ data }) => { + return data.lang === "fr" && !data.draft; + }); + const fragments = await getCollection("fragments", ({ data }) => { + return data.lang === "fr" && !data.draft; + }); + const posts = articles.concat(fragments); + return rss({ + // `<title>` field in output xml + title: "Nicolas Arduin", + // `<description>` field in output xml + description: "Articles publiés sur nardu.in", + // Pull in your project "site" from the endpoint context + // https://docs.astro.build/en/reference/api-reference/#contextsite + site: context.site, + // Array of `<item>`s in output xml + // See "Generating items" section for examples using content collections and glob imports + items: posts.map((post) => ({ + title: post.data.title, + pubDate: post.data.createdAt, + description: post.data.subtitle, + lang: post.data.lang, + // Compute RSS link from post `slug` + // This example assumes all posts are rendered as `/blog/[slug]` routes + link: `/${post.data.type}/${post.slug}/`, + })), + // (optional) inject custom xml + customData: `<language>fr-fr</language>`, + }); +}