add docsify forwarder & redirects

This commit is contained in:
Jack Humbert
2023-04-19 12:59:34 -04:00
parent fff2249a7c
commit db9f5c6013
5 changed files with 312 additions and 144 deletions

View File

@ -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
View File

@ -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",

View File

@ -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",

View 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 "";
}