This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/website/src/utils.js
Jens L d9f13e89c6
website: update release notes (#6590)
* 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>
2023-08-22 13:03:11 +02:00

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,
};