From 8613c016ed585a1bbea3a874c4f27ea7f88ad93d Mon Sep 17 00:00:00 2001 From: Francis Chartrand Date: Wed, 13 Nov 2024 11:14:19 -0500 Subject: [PATCH 1/2] fix(gatsby): fix redirection not working since v4 --- gatsby-config.js | 1 + gatsby-node.js | 2 +- package.json | 1 + yarn.lock | 9 ++++++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 6a3c3416..0e62dcb3 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -7,6 +7,7 @@ const path = require('path'); */ module.exports = { + trailingSlash: 'always', plugins: [ 'gatsby-plugin-react-helmet', { diff --git a/gatsby-node.js b/gatsby-node.js index 6d100d64..c38fbbcb 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -538,7 +538,7 @@ exports.createPages = async ({ graphql, actions: { createPage, createRedirect } // --------- console.log('Generating 301 redirects'); const generate301 = (fromPath, toPath) => { - const enhancedFromPath = fromPath.endsWith('.html') ? fromPath : fromPath.endsWith('/') ? fromPath : `${fromPath}/` + const enhancedFromPath = fromPath.endsWith('.html') || fromPath.endsWith('/') ? fromPath : `${fromPath}/` createRedirect({ fromPath: enhancedFromPath, diff --git a/package.json b/package.json index d5ea90c5..d818a44c 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "babel-plugin-styled-components": "^2.0.7", "btoa": "^1.2.1", "gatsby": "^4.18.2", + "gatsby-plugin-meta-redirect": "^1.1.1", "gatsby-plugin-react-helmet": "^5.18.0", "gatsby-plugin-styled-components": "^5.18.0", "gatsby-remark-autolink-headers": "^5.18.1", diff --git a/yarn.lock b/yarn.lock index 13504893..baf0be28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5456,7 +5456,7 @@ fs-extra@^10.1.0: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^7.0.1: +fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -5640,6 +5640,13 @@ gatsby-parcel-config@0.15.1: "@parcel/transformer-js" "2.6.2" "@parcel/transformer-json" "2.6.2" +gatsby-plugin-meta-redirect@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/gatsby-plugin-meta-redirect/-/gatsby-plugin-meta-redirect-1.1.1.tgz#058e8e53edff38dc44d3bb6153109d01c910f863" + integrity sha512-Oc4qgU3SlDUM9qoxIMKO+re2bdMs3/a2KXrfL65gb8XMLsHylBbveWtXZRhgjd2QDL/49RX4S9SEykuadRju2w== + dependencies: + fs-extra "^7.0.0" + gatsby-plugin-page-creator@^4.24.1: version "4.24.1" resolved "https://registry.yarnpkg.com/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-4.24.1.tgz#1088c2c4ea115f65008ebc0fb21da1403c6326d1" From 487a9381a627d2cd31729444d0ec3edffeea0b30 Mon Sep 17 00:00:00 2001 From: Francis Chartrand Date: Wed, 13 Nov 2024 11:19:37 -0500 Subject: [PATCH 2/2] docs: bring back attribution page --- gatsby-node.js | 1 - website/redirects.ts | 2 +- website/uc-doc/attribution.md | 9 +++++++++ website/uc-doc/index.md | 7 +------ 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 website/uc-doc/attribution.md diff --git a/gatsby-node.js b/gatsby-node.js index c38fbbcb..1c2c4c79 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -578,7 +578,6 @@ exports.createPages = async ({ graphql, actions: { createPage, createRedirect } generate301('/uc-doc/system/wazo-confgend/introduction', '/uc-doc/system/wazo-confgend'); generate301('/uc-doc/system/wazo-dird/introduction', '/uc-doc/system/wazo-dird'); generate301('/uc-doc/introduction', '/uc-doc'); - generate301('/uc-doc/attribution', '/uc-doc'); generate301('/uc-doc/changelog', '/uc-doc'); generate301('/uc-doc/upgrade/old_upgrade_notes', '/uc-doc/upgrade/archives/upgrade_notes'); generate301('/uc-doc/upgrade/upgrade_from_wazo_18_03', '/uc-doc/upgrade/archives/upgrade_from_wazo_18_03'); diff --git a/website/redirects.ts b/website/redirects.ts index ac09f557..1b8c3474 100644 --- a/website/redirects.ts +++ b/website/redirects.ts @@ -61,7 +61,7 @@ const REDIRECTS: Options['redirects'] = [ to: '/uc-doc/system/wazo-dird', }, { - from: ['/uc-doc/introduction', '/uc-doc/attribution', '/uc-doc/changelog'], + from: ['/uc-doc/introduction', '/uc-doc/changelog'], to: '/uc-doc', }, { diff --git a/website/uc-doc/attribution.md b/website/uc-doc/attribution.md new file mode 100644 index 00000000..f4021121 --- /dev/null +++ b/website/uc-doc/attribution.md @@ -0,0 +1,9 @@ +--- +title: Attribution Notice +sidebar_class_name: hidden +--- + +The major part of this documentation has been copied (2016-11-25) from the XiVO documentation +(originally hosted at `http://documentation.xivo.io`). That documentation was licensed under the +[Create Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) +and was Copyright 2012-2016 Avencall diff --git a/website/uc-doc/index.md b/website/uc-doc/index.md index 950b8db8..620f627d 100644 --- a/website/uc-doc/index.md +++ b/website/uc-doc/index.md @@ -26,9 +26,4 @@ In November 2016, Proformatique Inc. was shut down and the development team [forked XiVO to create Wazo](/blog/introducing-wazo). Its first release, Wazo 16.16, was released in December 2016. -:::note[Attribution Notice] -The major part of this documentation has been copied (2016-11-25) from the -XiVO documentation (originally hosted at `http://documentation.xivo.io`). That documentation was licensed -under the [Create Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) -and was Copyright 2012-2016 Avencall -::: +See [Attribution Notice](/uc-doc/attribution/)