add docsify forwarder & redirects
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import DocsifyForwarder from '@site/src/components/DocsifyForwarder';
|
||||
|
||||
# Quantum Mechanical Keyboard Firmware
|
||||
|
||||
## What is QMK Firmware?
|
||||
@ -43,3 +45,5 @@ There are a lot of ways you can contribute to the QMK Community. The easiest way
|
||||
* [Translate our documentation into your language](translating.md)
|
||||
* [Report a bug](https://github.com/qmk/qmk_firmware/issues/new/choose)
|
||||
* [Open a Pull Request](contributing.md)
|
||||
|
||||
<DocsifyForwarder />
|
File diff suppressed because it is too large
Load Diff
24
docs/package-lock.json
generated
24
docs/package-lock.json
generated
@ -9,6 +9,7 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.0",
|
||||
"@docusaurus/plugin-client-redirects": "^2.4.0",
|
||||
"@docusaurus/preset-classic": "2.4.0",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.2.1",
|
||||
@ -2185,6 +2186,29 @@
|
||||
"react-dom": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@docusaurus/plugin-client-redirects": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.4.0.tgz",
|
||||
"integrity": "sha512-HsS+Dc2ZLWhfpjYJ5LIrOB/XfXZcElcC7o1iA4yIVtiFz+LHhwP863fhqbwSJ1c6tNDOYBH3HwbskHrc/PIn7Q==",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.0",
|
||||
"@docusaurus/logger": "2.4.0",
|
||||
"@docusaurus/utils": "2.4.0",
|
||||
"@docusaurus/utils-common": "2.4.0",
|
||||
"@docusaurus/utils-validation": "2.4.0",
|
||||
"eta": "^2.0.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
"react-dom": "^16.8.4 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@docusaurus/plugin-content-blog": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.4.0.tgz",
|
||||
|
@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.0",
|
||||
"@docusaurus/plugin-client-redirects": "^2.4.0",
|
||||
"@docusaurus/preset-classic": "2.4.0",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.2.1",
|
||||
|
18
docs/src/components/DocsifyForwarder.js
Normal file
18
docs/src/components/DocsifyForwarder.js
Normal file
@ -0,0 +1,18 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
function removeHashSlash(url) {
|
||||
return url.replace(/\/#\//, '/');
|
||||
}
|
||||
|
||||
export default function DocsifyForwarder(props) {
|
||||
const history = useHistory();
|
||||
const currentUrl = window.location.href;
|
||||
if (currentUrl.includes('/#/')) {
|
||||
const newUrl = removeHashSlash(currentUrl);
|
||||
window.history.replaceState({}, '', newUrl);
|
||||
const relativePath = new URL(newUrl).pathname;
|
||||
history.push(relativePath);
|
||||
}
|
||||
return "";
|
||||
}
|
Reference in New Issue
Block a user