Skip to content

Commit

Permalink
Merge pull request #18 from solo-io/subversion-button-rework
Browse files Browse the repository at this point in the history
Subversion dropdown converted to buttons
  • Loading branch information
toreysoloio committed May 1, 2024
2 parents 10f1326 + 6465a7b commit 41b4cd2
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 242 deletions.
14 changes: 14 additions & 0 deletions assets/docs/scss/custom/structure/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@
}
}

.sidebar-subversion-btn-group {
display: flex;
gap: 0.5rem;

padding-left: 1rem;
padding-right: 0.25rem;
margin-top: 18px;
margin-bottom: -8px;

.btn {
flex: 1 1 auto;
}
}

.sidebar-header,
.sidebar-menu {
// border-top: 1px solid var(--sidebar-border-color);
Expand Down
7 changes: 6 additions & 1 deletion exampleSite2/hugo-gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ searchSectionsIndex = []
version = "main"
linkVersion = "main"
url = "https://docs.solo.io/gloo-mesh-core/main/"
subversions = [ "v1", "v4" ]
[[params.versions.subversions]]
id = "v1"
label = "Version 1"
[[params.versions.subversions]]
id = "v4"
label = "Version 4"

[[params.versions]]
version = "2.5 (latest)"
Expand Down
10 changes: 9 additions & 1 deletion exampleSite2/hugo-mesh-core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ searchSectionsIndex = []

[[params.versions]]
version = "main"
dropdown = "main"
linkVersion = "main"
url = "http://localhost:1313/main/v1/"
subversions = [ "v1", "v4" ]
[[params.versions.subversions]]
id = "v1"
label = "K8s Gateway API"
[[params.versions.subversions]]
id = "v4"
label = "Classic"
dropdownDefault = true

[[params.versions]]
version = "2.5 (latest)"
dropdown = "2.5 (latest)"
linkVersion = "latest"
url = "http://localhost:1313/latest/"

Expand Down
28 changes: 27 additions & 1 deletion layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,36 @@
<div class="px-1">
<h1 class="text-center">Page not found :(</h1>
<h4 class="text-center">The page you are looking for doesn't exist or has been moved.</h4>
<h4 class="text-center">Redirecting to root...</h4>
</div>
<div class="px-1">
<a href="{{ "" | relURL }}"><i class="material-icons size-48 me-0">home</i></a>
<!-- <a href="{{ "" | relURL }}"><i class="material-icons size-48 me-0">menu_book</i></a> -->
</div>
</div>
</div>
<script>
setTimeout(function(){
var versionsMap = {};
{{ if .Site.Params.versions }}
{{ range .Site.Params.versions }}
{{ $version := .linkVersion }}
versionsMap["{{ $version }}"] = [];
{{ if .subversions }}
{{ range .subversions }}
versionsMap["{{ $version }}"].push("{{ .id }}");
{{ end }}
{{ end }}
{{ end }}
{{ end }}

var urlParts = window.location.pathname.split('/')
var version = urlParts.find(function(part){ return !!versionsMap[part] });
var subversion = !!version && urlParts.find(function(part){ return !!versionsMap[version].includes(part); });

var url = "{{ "" | relURL }}";
if(version) url += "/"+version;
if(subversion) url += "/"+subversion;
window.location.replace(url.replace('//', '/'));
}, 1000)
</script>
{{ end }}
Loading

0 comments on commit 41b4cd2

Please sign in to comment.