From a4578b471f50912580a18efd078b8d121812159e Mon Sep 17 00:00:00 2001 From: Joshua Fernandes Date: Sat, 12 Aug 2023 07:52:11 +1000 Subject: [PATCH] update routing paths (#1368) Signed-off-by: Joshua Fernandes --- docusaurus.config.js | 58 ++++++-------------------- package.json | 12 +++--- src/components/HomepageCards/index.tsx | 4 +- vercel.json | 19 +++++++++ yarn.lock | 2 +- 5 files changed, 40 insertions(+), 55 deletions(-) create mode 100644 vercel.json diff --git a/docusaurus.config.js b/docusaurus.config.js index 28b43567abd..c53bda0bdc2 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -34,7 +34,8 @@ const config = { sidebarPath: require.resolve("./sidebars.js"), // Set a base path separate from default /docs editUrl: "https://github.com/hyperledger/besu-docs/tree/main/", - // path: "docs", + path: "./docs", + includeCurrentVersion: true, lastVersion: "23.4.1", versions: { //defaults to the ./docs folder @@ -42,19 +43,13 @@ const config = { current: { label: "development", path: "development", - banner: "unreleased", }, //the last stable release in the versioned_docs/version-stable - // using 'stable' as path "23.4.1": { label: "stable (23.4.1)", - path: "stable", - banner: "none", }, "23.4.0": { label: "23.4.0", - path: "23.4.0", - banner: "unmaintained", }, }, routeBasePath: "/", @@ -70,7 +65,6 @@ const config = { ], showLastUpdateAuthor: false, showLastUpdateTime: true, - includeCurrentVersion: true, }, theme: { customCss: require.resolve("./src/css/custom.css"), @@ -164,23 +158,23 @@ const config = { items: [ { label: "Introduction", - to: "/stable/public-networks", + to: "/public-networks", }, { label: "How to guides", - to: "/stable/public-networks/how-to", + to: "/public-networks/how-to", }, { label: "Concepts", - to: "/stable/public-networks/concepts", + to: "/public-networks/concepts", }, { label: "Tutorials", - to: "/stable/public-networks/tutorials", + to: "/public-networks/tutorials", }, { label: "Reference", - to: "/stable/public-networks/reference", + to: "/public-networks/reference", }, ], }, @@ -189,23 +183,23 @@ const config = { items: [ { label: "Introduction", - to: "/stable/private-networks", + to: "/private-networks", }, { label: "How to guides", - to: "/stable/private-networks/how-to", + to: "/private-networks/how-to", }, { label: "Concepts", - to: "/stable/private-networks/concepts", + to: "/private-networks/concepts", }, { label: "Tutorials", - to: "/stable/private-networks/tutorials", + to: "/private-networks/tutorials", }, { label: "Reference", - to: "/stable/private-networks/reference", + to: "/private-networks/reference", }, ], }, @@ -278,34 +272,6 @@ const config = { containerId: "GTM-THG37T4", }, ], - [ - "@docusaurus/plugin-client-redirects", - { - redirects: [ - { - from: "/en/latest", - to: "/", - }, - { - from: "/en/stable", - to: "/", - }, - ], - createRedirects(existingPath) { - if (existingPath.includes("/development")) { - return [ - existingPath.replace("/development", "/en/development"), - existingPath.replace("/development", "/en/latest"), - existingPath.replace("/development", "/latest"), - ]; - } - if (existingPath.includes("/stable")) { - return [existingPath.replace("/stable", "/en/stable")]; - } - return undefined; // Return a falsy value: no redirect created - }, - }, - ], ], themes: [ [ diff --git a/package.json b/package.json index 07b6be738b5..7d5610bd23e 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,18 @@ "write-heading-ids": "docusaurus write-heading-ids", "typecheck": "tsc", "typecheck-staged": "tsc-files --noEmit", - "lint": "npm run lint:spelling && npm run lint:js && npm run lint:style", + "lint": "yarn run lint:spelling && yarn run lint:js && yarn run lint:style", "lint:js": "eslint . --ext js,jsx,ts,tsx --max-warnings=0", "lint:spelling": "cspell \"**\" --no-progress", "lint:style": "stylelint \"**/*.css\"", - "lint:fix": "npm run lint:js -- --fix", + "lint:fix": "yarn run lint:js -- --fix", "format": "prettier --write '{blog,docs,src,static}/**/*.{md,mdx,ts,js,tsx,jsx,json}'" }, "lint-staged": { - "**/*.{ts,tsx}": "npm run typecheck-staged", - "**/*.css": "npm run lint:style", - "**/*.{md,mdx}": "npm run lint:spelling", - "**/*.{md,mdx,ts,js,tsx,jsx,json}": "npm run format" + "**/*.{ts,tsx}": "yarn run typecheck-staged", + "**/*.css": "yarn run lint:style", + "**/*.{md,mdx}": "yarn run lint:spelling", + "**/*.{md,mdx,ts,js,tsx,jsx,json}": "yarn run format" }, "dependencies": { "@docusaurus/core": "^2.4.1", diff --git a/src/components/HomepageCards/index.tsx b/src/components/HomepageCards/index.tsx index ddea4e11859..0511274aa42 100644 --- a/src/components/HomepageCards/index.tsx +++ b/src/components/HomepageCards/index.tsx @@ -21,7 +21,7 @@ type CardItem = { const CardList: CardItem[] = [ { title: "🌐 Public networks", - link: "/stable/public-networks", + link: "/public-networks", // prettier-ignore description: ( <> @@ -33,7 +33,7 @@ const CardList: CardItem[] = [ }, { title: "🔐 Private networks", - link: "/stable/private-networks", + link: "/private-networks", // prettier-ignore description: ( <> diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000000..e372ebdf587 --- /dev/null +++ b/vercel.json @@ -0,0 +1,19 @@ +{ + "cleanUrls": true, + "redirects": [ + { "source": "/en/latest", "destination": "/development", "permanent": true }, + { "source": "/en/latest/", "destination": "/development", "permanent": true }, + { + "source": "/en/latest/:match(.*)", + "destination": "/development/:match(.*)", + "permanent": true + }, + { "source": "/en/stable", "destination": "/", "permanent": true }, + { "source": "/en/stable/", "destination": "/", "permanent": true }, + { + "source": "/en/stable/:match(.*)", + "destination": "/:match(.*)", + "permanent": true + } + ] +} diff --git a/yarn.lock b/yarn.lock index 0fe50d79a21..ca4e54fac9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13837,4 +13837,4 @@ yocto-queue@^1.0.0: zwitch@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920" - integrity sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw== + integrity sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw== \ No newline at end of file