Skip to content

Commit

Permalink
website: fix version dropdown (goauthentik#11641)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu authored Oct 9, 2024
1 parent 555bec8 commit b363951
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 61 deletions.
107 changes: 54 additions & 53 deletions website/sidebars.js
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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;
12 changes: 4 additions & 8 deletions website/src/utils.js
Original file line number Diff line number Diff line change
@@ -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 `<div class="navbar__item dropdown dropdown--hoverable dropdown--right">
<div aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link menu__link">
Expand All @@ -25,7 +25,3 @@ function generateVersionDropdown(sidebar) {
</div>
<hr>`;
}

module.exports = {
generateVersionDropdown,
};

0 comments on commit b363951

Please sign in to comment.