Skip to content

Commit 9472f5b

Browse files
committed
feat: redirect for patch routes
1 parent 3e5d2a0 commit 9472f5b

File tree

4 files changed

+40
-13
lines changed

4 files changed

+40
-13
lines changed

docusaurus.config.js

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
33

4-
const lightCodeTheme = require('prism-react-renderer').themes.github;
5-
const darkCodeTheme = require('prism-react-renderer').themes.dracula;
4+
const lightCodeTheme = require("prism-react-renderer").themes.github;
5+
const darkCodeTheme = require("prism-react-renderer").themes.dracula;
66
const { sortSidebarItems } = require("./sitebar-semver-sort");
77

88
const locales = ["en", "zh", "es", "fr", "de"];
@@ -34,7 +34,12 @@ const config = {
3434
defaultLocale: "en",
3535
locales,
3636
},
37-
37+
scripts: [
38+
{
39+
src: "/js/redirects.js",
40+
async: false,
41+
},
42+
],
3843
presets: [
3944
[
4045
"classic",
@@ -81,7 +86,7 @@ const config = {
8186
apiKey: "47111d6564a2e69ee21a1d3d2f786ef3",
8287
indexName: "unraid",
8388
contextualSearch: true,
84-
searchPagePath: 'search',
89+
searchPagePath: "search",
8590
},
8691
colorMode: { defaultMode: "dark", respectPrefersColorScheme: true },
8792
docs: {
@@ -103,7 +108,11 @@ const config = {
103108
media: "(prefers-color-scheme: light)",
104109
},
105110
{ name: "color-scheme", content: "dark light" },
106-
{ name: "keywords", content: "Unraid, server, storage, NAS, Docker, virtualization, array, parity, data protection, file sharing, plugins, management, GUI, disk management, caching, SSD, disk encryption, security, RAID, network configuration, backups, media server, transcoding, monitoring, VMs, GPU passthrough, hardware compatibility" },
111+
{
112+
name: "keywords",
113+
content:
114+
"Unraid, server, storage, NAS, Docker, virtualization, array, parity, data protection, file sharing, plugins, management, GUI, disk management, caching, SSD, disk encryption, security, RAID, network configuration, backups, media server, transcoding, monitoring, VMs, GPU passthrough, hardware compatibility",
115+
},
107116
],
108117
navbar: {
109118
title: "Unraid Docs",
@@ -201,21 +210,21 @@ const config = {
201210
prism: {
202211
theme: lightCodeTheme,
203212
darkTheme: darkCodeTheme,
204-
additionalLanguages: ['diff', 'json', 'bash'],
213+
additionalLanguages: ["diff", "json", "bash"],
205214
},
206215
zoom: {
207-
selector: '.markdown :not(em) > img',
216+
selector: ".markdown :not(em) > img",
208217
background: {
209-
light: 'rgb(255, 255, 255)',
210-
dark: 'rgb(50, 50, 50)'
218+
light: "rgb(255, 255, 255)",
219+
dark: "rgb(50, 50, 50)",
211220
},
212221
config: {
213222
// options you can specify via https://github.com/francoischalifour/medium-zoom#usage
214-
}
223+
},
215224
},
216225
}),
217226
plugins: [
218-
require.resolve('docusaurus-plugin-image-zoom'),
227+
require.resolve("docusaurus-plugin-image-zoom"),
219228
[
220229
"@docusaurus/plugin-ideal-image",
221230
{

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@docusaurus/core": "3.7.0",
21-
"@docusaurus/plugin-client-redirects": "^3.3.2",
21+
"@docusaurus/plugin-client-redirects": "^3.7.0",
2222
"@docusaurus/plugin-ideal-image": "^3.3.2",
2323
"@docusaurus/preset-classic": "3.7.0",
2424
"@mdx-js/react": "^3.0.1",

static/js/redirects.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Client-side redirects for Unraid docs
3+
* This script handles special URL patterns that need redirection
4+
*/
5+
(function() {
6+
// Check if the URL matches the pattern /unraid-os/release-notes/X.Y.Z+patch.N
7+
const patchRegex = /\/unraid-os\/release-notes\/(\d+\.\d+\.\d+)\+patch\.\d+/;
8+
const currentPath = window.location.pathname;
9+
const match = currentPath.match(patchRegex);
10+
11+
if (match) {
12+
// Get the base version (X.Y.Z)
13+
const baseVersion = match[1];
14+
15+
// Redirect to the patches section of that version
16+
window.location.href = `/unraid-os/release-notes/${baseVersion}#patches`;
17+
}
18+
})();

0 commit comments

Comments
 (0)