From d617e0a5aa12170a56192d76a0d8a0891492201f Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Tue, 19 Sep 2023 13:59:46 +0530 Subject: [PATCH 1/3] added sitemaps plugin --- v2/docusaurus.config.js | 6 ++++++ v2/package.json | 1 + 2 files changed, 7 insertions(+) diff --git a/v2/docusaurus.config.js b/v2/docusaurus.config.js index 17ee3700f..341ffc2cd 100644 --- a/v2/docusaurus.config.js +++ b/v2/docusaurus.config.js @@ -137,6 +137,12 @@ module.exports = { rehypePlugins: rehypePlugins, beforeDefaultRemarkPlugins, }, + sitemap:{ + changefreq: 'weekly', + priority: 0.5, + // ignorePatterns: ['/tags/**'], + // filename: 'sitemap.xml', + }, theme: { // this is applied to all docs.. not just the community one. customCss: require.resolve('./src/css/custom.css'), diff --git a/v2/package.json b/v2/package.json index 63c9ddcbe..6053b91d9 100644 --- a/v2/package.json +++ b/v2/package.json @@ -18,6 +18,7 @@ }, "dependencies": { "@docusaurus/core": "2.0.0-beta.3", + "@docusaurus/plugin-sitemap": "^2.4.1", "@docusaurus/preset-classic": "2.0.0-beta.3", "@mdx-js/react": "^1.6.21", "@svgr/webpack": "^5.5.0", From cb7e12947abd992b8bb3b90f3c4b545c48299ab3 Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Tue, 19 Sep 2023 15:02:05 +0530 Subject: [PATCH 2/3] uninstall sitemap plugin and keep generated sitemap.xml --- v2/buildDocsForProduction | 1 - v2/docusaurus.config.js | 6 ------ v2/package.json | 1 - 3 files changed, 8 deletions(-) diff --git a/v2/buildDocsForProduction b/v2/buildDocsForProduction index 63120ea46..c424fbb34 100755 --- a/v2/buildDocsForProduction +++ b/v2/buildDocsForProduction @@ -25,7 +25,6 @@ fi echo "Copying to supertokens-backend-website..." # remove unnecessary files -rm ./build/sitemap.xml rm ./build/index.html rm ./build/blog.html rm ./build/404.html diff --git a/v2/docusaurus.config.js b/v2/docusaurus.config.js index 341ffc2cd..17ee3700f 100644 --- a/v2/docusaurus.config.js +++ b/v2/docusaurus.config.js @@ -137,12 +137,6 @@ module.exports = { rehypePlugins: rehypePlugins, beforeDefaultRemarkPlugins, }, - sitemap:{ - changefreq: 'weekly', - priority: 0.5, - // ignorePatterns: ['/tags/**'], - // filename: 'sitemap.xml', - }, theme: { // this is applied to all docs.. not just the community one. customCss: require.resolve('./src/css/custom.css'), diff --git a/v2/package.json b/v2/package.json index 6053b91d9..63c9ddcbe 100644 --- a/v2/package.json +++ b/v2/package.json @@ -18,7 +18,6 @@ }, "dependencies": { "@docusaurus/core": "2.0.0-beta.3", - "@docusaurus/plugin-sitemap": "^2.4.1", "@docusaurus/preset-classic": "2.0.0-beta.3", "@mdx-js/react": "^1.6.21", "@svgr/webpack": "^5.5.0", From 5fab4fb89f0fc85e8b0769d24023292389d29923 Mon Sep 17 00:00:00 2001 From: Nemi Shah Date: Fri, 22 Sep 2023 17:32:17 +0530 Subject: [PATCH 3/3] Use location hook instead of window during rendering --- v2/src/theme/TOC/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/v2/src/theme/TOC/index.js b/v2/src/theme/TOC/index.js index def41fac1..e7b231747 100644 --- a/v2/src/theme/TOC/index.js +++ b/v2/src/theme/TOC/index.js @@ -9,6 +9,7 @@ import clsx from 'clsx'; import useTOCHighlight from '@theme/hooks/useTOCHighlight'; import styles from './styles.module.css'; import { getUIModeFromStorage, updateUIMode } from "../../components/preBuiltOrCustomUISwitcher"; +import { useLocation } from '@docusaurus/router'; const LINK_CLASS_NAME = 'table-of-contents__link'; const ACTIVE_LINK_CLASS_NAME = 'table-of-contents__link--active'; const TOP_OFFSET = 100; @@ -47,17 +48,18 @@ function Headings({ toc, isChild }) { ); } -const OldDocsDisclaimer = () => { +function OldDocsDisclaimer() { + const location = useLocation(); const goToVersioningPage = () => { window.location.href = "/docs/community/versioning"; } - if (window.location.href.includes("/docs/guides")) { - return <>; + if (location.pathname.includes("/docs/guides")) { + return
; } - if (window.location.href.includes("/docs/community/versioning")) { - return <>; + if (location.pathname.includes("/docs/community/versioning")) { + return
; } return ( @@ -147,7 +149,7 @@ function TOC({ toc, showUISwitcher }) { const unselectedBorderColorString = "var(--ui-selector-inactive-border)"; return (
- {/* */} +