diff --git a/website/sidebars.js b/website/sidebars.js index ac398d02eea6..5c18e14fe3ac 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -1,11 +1,60 @@ -const generateVersionDropdown = - require("./src/utils.js").generateVersionDropdown; -const apiReference = require("./docs/developer-docs/api/reference/sidebar"); +import { generateVersionDropdown } from "./src/utils.js"; +import apiReference from "./docs/developer-docs/api/reference/sidebar"; -const docsSidebar = { +const releases = [ + "releases/2024/v2024.8", + "releases/2024/v2024.6", + "releases/2024/v2024.4", + { + type: "category", + label: "Previous versions", + items: [ + "releases/2024/v2024.2", + "releases/2023/v2023.10", + "releases/2023/v2023.8", + "releases/2023/v2023.6", + "releases/2023/v2023.5", + "releases/2023/v2023.4", + "releases/2023/v2023.3", + "releases/2023/v2023.2", + "releases/2023/v2023.1", + "releases/2022/v2022.12", + "releases/2022/v2022.11", + "releases/2022/v2022.10", + "releases/2022/v2022.9", + "releases/2022/v2022.8", + "releases/2022/v2022.7", + "releases/2022/v2022.6", + "releases/2022/v2022.5", + "releases/2022/v2022.4", + "releases/2022/v2022.2", + "releases/2022/v2022.1", + "releases/2021/v2021.12", + "releases/2021/v2021.10", + "releases/2021/v2021.9", + "releases/2021/v2021.8", + "releases/2021/v2021.7", + "releases/2021/v2021.6", + "releases/2021/v2021.5", + "releases/2021/v2021.4", + "releases/2021/v2021.3", + "releases/2021/v2021.2", + "releases/2021/v2021.1", + "releases/old/v0.14", + "releases/old/v0.13", + "releases/old/v0.12", + "releases/old/v0.11", + "releases/old/v0.10", + "releases/old/v0.9", + ], + }, +]; + +export default { docs: [ { type: "html", + value: generateVersionDropdown(releases), }, { type: "doc", @@ -656,55 +705,7 @@ const docsSidebar = { slug: "releases", description: "Release Notes for recent authentik versions", }, - items: [ - "releases/2024/v2024.6", - "releases/2024/v2024.4", - "releases/2024/v2024.2", - { - type: "category", - label: "Previous versions", - items: [ - "releases/2023/v2023.10", - "releases/2023/v2023.8", - "releases/2023/v2023.6", - "releases/2023/v2023.5", - "releases/2023/v2023.4", - "releases/2023/v2023.3", - "releases/2023/v2023.2", - "releases/2023/v2023.1", - "releases/2022/v2022.12", - "releases/2022/v2022.11", - "releases/2022/v2022.10", - "releases/2022/v2022.9", - "releases/2022/v2022.8", - "releases/2022/v2022.7", - "releases/2022/v2022.6", - "releases/2022/v2022.5", - "releases/2022/v2022.4", - "releases/2022/v2022.2", - "releases/2022/v2022.1", - "releases/2021/v2021.12", - "releases/2021/v2021.10", - "releases/2021/v2021.9", - "releases/2021/v2021.8", - "releases/2021/v2021.7", - "releases/2021/v2021.6", - "releases/2021/v2021.5", - "releases/2021/v2021.4", - "releases/2021/v2021.3", - "releases/2021/v2021.2", - "releases/2021/v2021.1", - "releases/old/v0.14", - "releases/old/v0.13", - "releases/old/v0.12", - "releases/old/v0.11", - "releases/old/v0.10", - "releases/old/v0.9", - ], - }, - ], + items: releases, }, ], }; -docsSidebar.docs[0].value = generateVersionDropdown(docsSidebar); -module.exports = docsSidebar; diff --git a/website/src/utils.js b/website/src/utils.js index b2d2d4938ee8..421244498cbf 100644 --- a/website/src/utils.js +++ b/website/src/utils.js @@ -1,7 +1,7 @@ -function generateVersionDropdown(sidebar) { - const releases = sidebar.docs - .filter((doc) => doc.link?.slug === "releases")[0] - .items.filter((release) => typeof release === "string"); +export function generateVersionDropdown(allReleases) { + const releases = allReleases.filter( + (release) => typeof release === "string", + ); const latest = releases[0].replace(/releases\/\d+\/v/, ""); return `