From 0db1fb0c0b4074d02f0660deee9397387e357b18 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 12 Dec 2025 21:33:32 +0100 Subject: [PATCH] provide version dropdown in docs --- docs/input/_Navbar.cshtml | 58 ++++++++++++++++++++++++++++- docs/input/assets/css/override.less | 41 ++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) diff --git a/docs/input/_Navbar.cshtml b/docs/input/_Navbar.cshtml index 3a1031af19..1e06dc1d96 100644 --- a/docs/input/_Navbar.cshtml +++ b/docs/input/_Navbar.cshtml @@ -3,11 +3,65 @@ { Tuple.Create("Documentation", Context.GetLink("docs")), Tuple.Create("API", Context.GetLink("api")), - Tuple.Create(" 5.12.0", "/5.12.0/docs"), }; + + // Define a list of versions with their respective links and status (e.g., latest, EOL). + var VersionList = new List<(string Name, string Link, string Status, bool IsReleased)> + { + ("5.12", "/5.12.0/docs", "(EOL)", true), + ("6.0", "/6.0.0/docs", "", true), + ("6.1-6.3", "/", "(latest)", true), + ("main branch", "/dev/docs", "(unstable)", false), + }; + + // determine currently viewed version + var CurrentlyViewedVersion = VersionList.Last().Name; + @foreach (var version in VersionList) + { + if (Context.GetLink(Document).StartsWith(version.Link)) + { + CurrentlyViewedVersion = version.Name; + break; + } + } + foreach(Tuple p in pages) { string active = Context.GetLink(Document).StartsWith(p.Item2) ? "active" : null;
  • @Html.Raw(p.Item1)
  • } -} \ No newline at end of file + + +} diff --git a/docs/input/assets/css/override.less b/docs/input/assets/css/override.less index b5b943276c..dbb1df9a5d 100644 --- a/docs/input/assets/css/override.less +++ b/docs/input/assets/css/override.less @@ -259,3 +259,44 @@ main .col-sm-6 { flex-direction: column; } } + +.dropdown { + display: inline-block; + left: 550px; +} + +/* Dropdown Button */ +.dropbtn { + padding: 16px; + border: none; + cursor: pointer; +} + +/* Dropdown content (hidden by default) */ +.dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 150px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; +} + +/* Links inside dropdown content */ +.dropdown-content a { + color: black; + padding: 12px 16px; + text-decoration: none; + display: block; +} + +/* Change color of dropdown links on hover */ +.dropdown-content a:hover { + background-color: #f1f1f1 +} + +/* Show the dropdown content on hover */ +.dropdown:hover .dropdown-content { + display: block; + padding: 12px 16px; +}