From e3fb3b3e0fc86bcf2a9cc8fd8a5a21f405ab74e1 Mon Sep 17 00:00:00 2001 From: Ayc0 Date: Tue, 19 Aug 2025 22:40:45 +0200 Subject: [PATCH] clean up tags --- src/components/get-posts.ts | 10 ++-- src/content/config.ts | 56 +++++++------------ .../posts/CSS/how-to-learn-css-with-games.mdx | 2 +- .../posts/CSS/proper-cross-fade-in-css.mdx | 2 +- .../light-dark-mode-react-implementation.mdx | 2 +- .../blocz-react-responsive-v3-is-out.mdx | 2 +- .../Others/blocz-react-responsive-v4.mdx | 2 +- ...-dont-use-stringsplit-nor-stringlength.mdx | 2 +- .../posts/Others/monitoring-websockets.mdx | 2 +- .../posts/Others/semver-the-unknown-parts.mdx | 2 +- ...rating-class-components-to-hooks-rules.mdx | 2 +- .../migrating-class-components-to-hooks.mdx | 2 +- .../React/react-life-cycles-and-timings.mdx | 2 +- .../React/react-refs-and-dom-references.mdx | 4 +- .../React/responsive-design-in-react.mdx | 2 +- .../typescript-49-satisfies-operator.mdx | 2 +- .../typescript-50-new-mode-bundler-esm.mdx | 2 +- .../posts/Yarn/yarn-lock-how-to-read-it.mdx | 4 +- .../posts/Yarn/yarn-lock-how-to-update-it.mdx | 4 +- .../docs/posts/Yarn/yarn-the-good-parts.mdx | 2 +- src/content/docs/posts/tags.mdx | 6 +- 21 files changed, 48 insertions(+), 66 deletions(-) diff --git a/src/components/get-posts.ts b/src/components/get-posts.ts index 36227be..a6602dc 100644 --- a/src/components/get-posts.ts +++ b/src/components/get-posts.ts @@ -53,10 +53,8 @@ export const getPublishablePostsBySection = async (): Promise< return groups; }; -export const getPublishablePostsByTags = async (): Promise< - Record -> => { - const posts = await getPublishablePosts(); +export const getPostsByTags = async (): Promise> => { + const posts = await getCollection("docs"); const tagGroups: Record = {}; for (const post of posts) { for (const tag of post.data.tags || []) { @@ -65,7 +63,9 @@ export const getPublishablePostsByTags = async (): Promise< } } - return tagGroups; + return Object.fromEntries( + Object.entries(tagGroups).sort((a, b) => a[0].localeCompare(b[0])), + ); }; export const getDraftPosts = async () => { diff --git a/src/content/config.ts b/src/content/config.ts index 1c3f620..9873e94 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,44 +1,26 @@ import { defineCollection, z } from "astro:content"; import { docsSchema } from "@astrojs/starlight/schema"; -// TODO: clean those a bit +// TODO: add dark-mode const tags = [ - "css", // Used 12 times - "webdev", // Used 10 times - "javascript", // Used 10 times - "react", // Used 8 times - "responsive", // Used 3 times - "typescript", // Used 3 times - "yarn", // Used 3 times - "tip", // Used 2 times - "package", // Used 2 times - "hooks", // Used 2 times - "migration", // Used 2 times - "config", // Used 2 times - "lockfile", // Used 2 times - "html", // Used 1 times - "fundamentals", // Used 1 times - "learn", // Used 1 times - "tutorial", // Used 1 times - "parcel", // Used 1 times - "bundler", // Used 1 times - "intl", // Used 1 times - "encoding", // Used 1 times - "unicode", // Used 1 times - "monitoring", // Used 1 times - "websocket", // Used 1 times - "discuss", // Used 1 times - "npm", // Used 1 times - "semver", // Used 1 times - "versioning", // Used 1 times - "lifecycle", // Used 1 times - "task", // Used 1 times - "async", // Used 1 times - "refs", // Used 1 times - "dom", // Used 1 times - "breakpoints", // Used 1 times - "operator", // Used 1 times - "berry", // Used 1 times + "bundler", + "css", + "deep-dive", + "dom", + "fundamentals", + "html", + "javascript", + "news", + "npm", + "parcel", + "react", + "tip", + "typescript", + "unicode", + "versioning", + "webdev", + "websocket", + "yarn", ] as const; export const collections = { diff --git a/src/content/docs/posts/CSS/how-to-learn-css-with-games.mdx b/src/content/docs/posts/CSS/how-to-learn-css-with-games.mdx index 2acc737..c4488f6 100644 --- a/src/content/docs/posts/CSS/how-to-learn-css-with-games.mdx +++ b/src/content/docs/posts/CSS/how-to-learn-css-with-games.mdx @@ -1,6 +1,6 @@ --- title: "How to learn CSS with games" -tags: ["css", "learn"] +tags: ["css", "tip"] createdAt: 2023-01-26 lastUpdated: 2023-01-26 sidebar: diff --git a/src/content/docs/posts/CSS/proper-cross-fade-in-css.mdx b/src/content/docs/posts/CSS/proper-cross-fade-in-css.mdx index 5af957e..0898bf3 100644 --- a/src/content/docs/posts/CSS/proper-cross-fade-in-css.mdx +++ b/src/content/docs/posts/CSS/proper-cross-fade-in-css.mdx @@ -1,6 +1,6 @@ --- title: "Proper cross-fade in CSS" -tags: ["css", "webdev", "tutorial"] +tags: ["css", "webdev"] createdAt: 2022-10-06 lastUpdated: 2022-10-06 sidebar: diff --git a/src/content/docs/posts/Dark mode/light-dark-mode-react-implementation.mdx b/src/content/docs/posts/Dark mode/light-dark-mode-react-implementation.mdx index e5a020e..d30f53c 100644 --- a/src/content/docs/posts/Dark mode/light-dark-mode-react-implementation.mdx +++ b/src/content/docs/posts/Dark mode/light-dark-mode-react-implementation.mdx @@ -1,6 +1,6 @@ --- title: "Light/dark mode: React implementation" -tags: ["webdev", "css", "react", "javascript"] +tags: ["webdev", "css", "react", "javascript", "deep-dive"] createdAt: 2021-06-24 lastUpdated: 2023-01-16 sidebar: diff --git a/src/content/docs/posts/Others/blocz-react-responsive-v3-is-out.mdx b/src/content/docs/posts/Others/blocz-react-responsive-v3-is-out.mdx index 9badd87..0e9f9e9 100644 --- a/src/content/docs/posts/Others/blocz-react-responsive-v3-is-out.mdx +++ b/src/content/docs/posts/Others/blocz-react-responsive-v3-is-out.mdx @@ -1,6 +1,6 @@ --- title: "@blocz/react-responsive v3 is out" -tags: ["react", "responsive", "package"] +tags: ["react", "news"] createdAt: 2021-03-12 lastUpdated: 2021-03-12 description: "@blocz/react-responsive v3 was just released. Let’s go through all the different features and changes added by this new major version" diff --git a/src/content/docs/posts/Others/blocz-react-responsive-v4.mdx b/src/content/docs/posts/Others/blocz-react-responsive-v4.mdx index 9289e65..920bed7 100644 --- a/src/content/docs/posts/Others/blocz-react-responsive-v4.mdx +++ b/src/content/docs/posts/Others/blocz-react-responsive-v4.mdx @@ -1,6 +1,6 @@ --- title: "@blocz/react-responsive v4" -tags: ["react", "responsive", "package"] +tags: ["react", "news"] createdAt: 2025-01-01 description: "@blocz/react-responsive v4 was just released. Let’s go through all the different features and changes added by this new major version" image: /src/assets/react-responsive.png diff --git a/src/content/docs/posts/Others/intlsegmenter-dont-use-stringsplit-nor-stringlength.mdx b/src/content/docs/posts/Others/intlsegmenter-dont-use-stringsplit-nor-stringlength.mdx index fa8f67c..047c721 100644 --- a/src/content/docs/posts/Others/intlsegmenter-dont-use-stringsplit-nor-stringlength.mdx +++ b/src/content/docs/posts/Others/intlsegmenter-dont-use-stringsplit-nor-stringlength.mdx @@ -1,6 +1,6 @@ --- title: "Intl.Segmenter(): Don't use string.split() nor string.length" -tags: ["javascript", "intl", "encoding", "unicode"] +tags: ["javascript", "unicode"] createdAt: 2023-07-25 lastUpdated: 2023-10-10 image: /src/assets/excalidraw/intl-splash-image.png diff --git a/src/content/docs/posts/Others/monitoring-websockets.mdx b/src/content/docs/posts/Others/monitoring-websockets.mdx index aacd7f4..c1c24d5 100644 --- a/src/content/docs/posts/Others/monitoring-websockets.mdx +++ b/src/content/docs/posts/Others/monitoring-websockets.mdx @@ -1,6 +1,6 @@ --- title: "Monitoring WebSockets" -tags: ["javascript", "tip", "monitoring", "websocket"] +tags: ["javascript", "websocket"] createdAt: 2024-12-23 lastUpdated: 2024-12-23 image: /src/assets/monitoring-websockets.png diff --git a/src/content/docs/posts/Others/semver-the-unknown-parts.mdx b/src/content/docs/posts/Others/semver-the-unknown-parts.mdx index de01016..8615b6c 100644 --- a/src/content/docs/posts/Others/semver-the-unknown-parts.mdx +++ b/src/content/docs/posts/Others/semver-the-unknown-parts.mdx @@ -1,6 +1,6 @@ --- title: "Semver: The unknown buildMetadata" -tags: ["discuss", "npm", "semver", "versioning"] +tags: ["npm", "versioning"] createdAt: 2022-07-14 lastUpdated: 2022-07-14 description: "The semver’s spec mentions a group called “buildMetadata”. If you’ve never heard of this before, you’re not alone" diff --git a/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx b/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx index 88741af..a7f9893 100644 --- a/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx +++ b/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx @@ -1,6 +1,6 @@ --- title: "Migrating class components to hooks – rules" -tags: ["react", "hooks", "migration"] +tags: ["react"] createdAt: 2020-08-18 lastUpdated: 2020-08-18 sidebar: diff --git a/src/content/docs/posts/React/migrating-class-components-to-hooks.mdx b/src/content/docs/posts/React/migrating-class-components-to-hooks.mdx index 4a73aea..58d1627 100644 --- a/src/content/docs/posts/React/migrating-class-components-to-hooks.mdx +++ b/src/content/docs/posts/React/migrating-class-components-to-hooks.mdx @@ -1,6 +1,6 @@ --- title: "Migrating class components to hooks" -tags: ["react", "hooks", "migration"] +tags: ["react"] createdAt: 2020-05-03 lastUpdated: 2020-05-03 image: /src/assets/react-responsive.png diff --git a/src/content/docs/posts/React/react-life-cycles-and-timings.mdx b/src/content/docs/posts/React/react-life-cycles-and-timings.mdx index 529a8a8..68a05a2 100644 --- a/src/content/docs/posts/React/react-life-cycles-and-timings.mdx +++ b/src/content/docs/posts/React/react-life-cycles-and-timings.mdx @@ -1,7 +1,7 @@ --- title: "React life-cycles & timings" slug: "posts/drafts/3658a2d9-6ccd-41e5-9972-c37c95ca31e1" -tags: ["lifecycle", "task", "async"] +tags: ["react", "deep-dive"] createdAt: 2024-11-07 lastUpdated: 2024-11-07 sidebar: diff --git a/src/content/docs/posts/React/react-refs-and-dom-references.mdx b/src/content/docs/posts/React/react-refs-and-dom-references.mdx index 5a1ea80..940cbd0 100644 --- a/src/content/docs/posts/React/react-refs-and-dom-references.mdx +++ b/src/content/docs/posts/React/react-refs-and-dom-references.mdx @@ -1,6 +1,6 @@ --- -title: "React refs and dom references" -tags: ["react", "refs", "dom"] +title: "React refs and DOM references" +tags: ["react", "dom"] createdAt: 2020-08-21 lastUpdated: 2020-08-21 sidebar: diff --git a/src/content/docs/posts/React/responsive-design-in-react.mdx b/src/content/docs/posts/React/responsive-design-in-react.mdx index 74ed2a2..eb7f3ec 100644 --- a/src/content/docs/posts/React/responsive-design-in-react.mdx +++ b/src/content/docs/posts/React/responsive-design-in-react.mdx @@ -1,6 +1,6 @@ --- title: "Responsive design in React" -tags: ["react", "responsive", "breakpoints"] +tags: ["react", "webdev"] createdAt: 2021-05-09 lastUpdated: 2021-05-09 sidebar: diff --git a/src/content/docs/posts/TypeScript/typescript-49-satisfies-operator.mdx b/src/content/docs/posts/TypeScript/typescript-49-satisfies-operator.mdx index 3e80ca5..bf9b5d3 100644 --- a/src/content/docs/posts/TypeScript/typescript-49-satisfies-operator.mdx +++ b/src/content/docs/posts/TypeScript/typescript-49-satisfies-operator.mdx @@ -1,6 +1,6 @@ --- title: "TypeScript 4.9: satisfies operator" -tags: ["typescript", "operator"] +tags: ["typescript", "news"] createdAt: 2022-09-25 lastUpdated: 2022-11-21 sidebar: diff --git a/src/content/docs/posts/TypeScript/typescript-50-new-mode-bundler-esm.mdx b/src/content/docs/posts/TypeScript/typescript-50-new-mode-bundler-esm.mdx index 974df1b..9ced414 100644 --- a/src/content/docs/posts/TypeScript/typescript-50-new-mode-bundler-esm.mdx +++ b/src/content/docs/posts/TypeScript/typescript-50-new-mode-bundler-esm.mdx @@ -1,6 +1,6 @@ --- title: "TypeScript 5.0: new mode bundler & ESM" -tags: ["typescript", "javascript"] +tags: ["typescript", "javascript", "news"] createdAt: 2023-04-11 lastUpdated: 2023-04-11 sidebar: diff --git a/src/content/docs/posts/Yarn/yarn-lock-how-to-read-it.mdx b/src/content/docs/posts/Yarn/yarn-lock-how-to-read-it.mdx index 6b308f8..04f6924 100644 --- a/src/content/docs/posts/Yarn/yarn-lock-how-to-read-it.mdx +++ b/src/content/docs/posts/Yarn/yarn-lock-how-to-read-it.mdx @@ -1,6 +1,6 @@ --- -title: "Yarn.lock: How to Read it" -tags: ["yarn", "config", "lockfile"] +title: "Yarn.lock: How to read it" +tags: ["yarn", "tip"] createdAt: 2021-07-27 lastUpdated: 2021-09-05 sidebar: diff --git a/src/content/docs/posts/Yarn/yarn-lock-how-to-update-it.mdx b/src/content/docs/posts/Yarn/yarn-lock-how-to-update-it.mdx index a1d61ec..da0985b 100644 --- a/src/content/docs/posts/Yarn/yarn-lock-how-to-update-it.mdx +++ b/src/content/docs/posts/Yarn/yarn-lock-how-to-update-it.mdx @@ -1,6 +1,6 @@ --- -title: "Yarn.lock: How to Update it" -tags: ["yarn", "config", "lockfile"] +title: "Yarn.lock: How to update it" +tags: ["yarn", "tip"] createdAt: 2021-09-05 lastUpdated: 2025-01-24 sidebar: diff --git a/src/content/docs/posts/Yarn/yarn-the-good-parts.mdx b/src/content/docs/posts/Yarn/yarn-the-good-parts.mdx index fe02a44..9ce1e84 100644 --- a/src/content/docs/posts/Yarn/yarn-the-good-parts.mdx +++ b/src/content/docs/posts/Yarn/yarn-the-good-parts.mdx @@ -1,7 +1,7 @@ --- title: "Yarn: The Good Parts" slug: "posts/drafts/c76a8169-e153-4981-b780-80fcf1b75f1a" -tags: ["yarn", "berry", "javascript"] +tags: ["yarn"] createdAt: 2025-08-06 image: /src/assets/pkcen3s6x5403jl6usey.jpeg description: "TODO" diff --git a/src/content/docs/posts/tags.mdx b/src/content/docs/posts/tags.mdx index 38fddf8..a3f1489 100644 --- a/src/content/docs/posts/tags.mdx +++ b/src/content/docs/posts/tags.mdx @@ -4,11 +4,11 @@ template: splash --- import LinkToPost from "@components/LinkToPost.astro"; -import { getPublishablePostsByTags } from "@components/get-posts"; +import { getPostsByTags } from "@components/get-posts"; { -Object.entries(await getPublishablePostsByTags()).map(([tag, posts]) => { -return (<>

#{tag}

+Object.entries(await getPostsByTags()).map(([tag, posts]) => { +return (<>

#{tag} ({posts.length})

    {posts.map(post =>
  • {post.data.title} | {post.data.tags.map(tag => `#${tag}`).join(' ')}
  • )} -- 2.51.2