d9f13e89c6
* move 2023.7 to 2023.8 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * move version dropdown from navbar to sidebar, and only have it on applicable sites Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove title instead of just hiding it Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix some styling for the mobile navbar sidebar Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add social image Signed-off-by: Jens Langhammer <jens@goauthentik.io> * Optimised images with calibre/image-actions * fix website tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com>
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
function generateVersionDropdown(sidebar) {
|
|
const releases = sidebar.docs
|
|
.filter((doc) => doc.link?.slug === "releases")[0]
|
|
.items.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">
|
|
Version: ${latest}
|
|
</div>
|
|
<ul class="dropdown__menu">
|
|
${releases
|
|
.map((release) => {
|
|
const version = release.replace(/releases\/\d+\/v/, "");
|
|
const subdomain = `version-${version.replace(".", "-")}`;
|
|
const label = `Version: ${version}`;
|
|
return `<li>
|
|
<a
|
|
href="https://${subdomain}.goauthentik.io/docs"
|
|
target="_blank" rel="noopener noreferrer"
|
|
class="dropdown__link">${label}</a>
|
|
</li>`;
|
|
})
|
|
.join("")}
|
|
</ul>
|
|
</div>
|
|
<hr>`;
|
|
}
|
|
|
|
module.exports = {
|
|
generateVersionDropdown,
|
|
};
|