diff --git a/astro.config.mjs b/astro.config.mjs index bea59a7..4632207 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -21,6 +21,10 @@ export default defineConfig({ }, // Technically not required, but to avoid having the next/prev buttons at the bottom of other pages sidebar: [ + { + label: "React", + autogenerate: { directory: "posts/React" }, + }, { label: "Dark mode", autogenerate: { directory: "posts/Dark mode" }, @@ -44,4 +48,16 @@ export default defineConfig({ ], }), ], + + // Add redirects for old URLs (before the creation of the React section) + redirects: { + "/posts/other/responsive-design-in-react": + "/posts/react/responsive-design-in-react", + "/posts/other/react-refs-and-dom-references": + "/posts/react/react-refs-and-dom-references", + "/posts/other/migrating-class-components-to-hooks-rules": + "/posts/react/migrating-class-components-to-hooks-rules", + "/posts/other/migrating-class-components-to-hooks": + "/posts/react/migrating-class-components-to-hooks", + }, }); diff --git a/src/components/get-publishable-posts.ts b/src/components/get-publishable-posts.ts index d267629..8242e35 100644 --- a/src/components/get-publishable-posts.ts +++ b/src/components/get-publishable-posts.ts @@ -16,7 +16,7 @@ export const getPublishablePosts = async () => { ); }; -const sections = ["Dark mode", "CSS", "TypeScript", "Yarn", "Others"]; +const sections = ["React", "Dark mode", "CSS", "TypeScript", "Yarn", "Others"]; export const getPublishablePostsBySection = async () => { const posts = await getPublishablePosts(); 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 11b0036..eca92ab 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 @@ -31,7 +31,7 @@ This library evolved as the react community evolved too: - in the v0 we had breakpoints, providers, and support for CSS-in-JS - the v1 was a major re-write in TypeScript and around react hooks (checkout out the following post for tips on how to upgrade class components to hooks) - + - the v2 was a major re-write for react contexts (the previous implementation didn't work if we had multiple providers in the same app) ### v3 diff --git a/src/content/docs/posts/Others/migrating-class-components-to-hooks-rules.mdx b/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx similarity index 96% rename from src/content/docs/posts/Others/migrating-class-components-to-hooks-rules.mdx rename to src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx index 50c993c..0f36b6c 100644 --- a/src/content/docs/posts/Others/migrating-class-components-to-hooks-rules.mdx +++ b/src/content/docs/posts/React/migrating-class-components-to-hooks-rules.mdx @@ -38,4 +38,4 @@ If those aren't enough, these are the final rules: If you want to see a concrete application of these rules, you can check this post in which I wrote a detailed migration of [react-only](https://www.npmjs.com/package/react-only): - + diff --git a/src/content/docs/posts/Others/migrating-class-components-to-hooks.mdx b/src/content/docs/posts/React/migrating-class-components-to-hooks.mdx similarity index 100% rename from src/content/docs/posts/Others/migrating-class-components-to-hooks.mdx rename to src/content/docs/posts/React/migrating-class-components-to-hooks.mdx diff --git a/src/content/docs/posts/Others/react-refs-and-dom-references.mdx b/src/content/docs/posts/React/react-refs-and-dom-references.mdx similarity index 100% rename from src/content/docs/posts/Others/react-refs-and-dom-references.mdx rename to src/content/docs/posts/React/react-refs-and-dom-references.mdx diff --git a/src/content/docs/posts/Others/responsive-design-in-react.mdx b/src/content/docs/posts/React/responsive-design-in-react.mdx similarity index 100% rename from src/content/docs/posts/Others/responsive-design-in-react.mdx rename to src/content/docs/posts/React/responsive-design-in-react.mdx