-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add git repo as a top-level menu #347
Open
flyrain
wants to merge
2
commits into
apache:main
Choose a base branch
from
flyrain:add-github-menu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+100
−95
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,100 +23,102 @@ | |
{{ $baseURL := urls.Parse $.Site.Params.Baseurl -}} | ||
|
||
<nav class="td-navbar js-navbar-scroll | ||
{{- if $cover }} td-navbar-cover {{- end }}" data-bs-theme="dark"> | ||
<div class="container-fluid flex-column flex-md-row"> | ||
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"> | ||
{{- /**/ -}} | ||
<span class="navbar-brand__logo navbar-logo"> | ||
{{- if ne .Site.Params.ui.navbar_logo false -}} | ||
{{ with resources.Get "icons/logo.svg" -}} | ||
{{ ( . | minify).Content | safeHTML -}} | ||
{{ end -}} | ||
{{ end -}} | ||
</span> | ||
{{- /**/ -}} | ||
<span class="navbar-brand__name"> | ||
{{- /* .Site.Title */ -}} | ||
</span> | ||
{{- /**/ -}} | ||
</a> | ||
<div class="td-navbar-nav-scroll ms-md-auto" id="main_navbar"> | ||
<ul class="navbar-nav"> | ||
{{ $p := . -}} | ||
{{ $s := .Site -}} | ||
{{ range .Site.Menus.main -}} | ||
{{ if .HasChildren }} | ||
{{/* | ||
Customized to have drop-down menus in the navbar and 'Releases' not at the very right | ||
*/}} | ||
<div class="dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
{{- .Pre -}} | ||
<span>{{ .Name }}</span> | ||
</a> | ||
<ul class="dropdown-menu"> | ||
{{ $children := .Children.ByWeight -}} | ||
{{ if eq .Identifier "releases" -}} | ||
{{ with (partial "releasePages.html" (dict "site" $s)).active -}} | ||
{{ range . -}} | ||
<a class="dropdown-item" href="{{ .RelPermalink }}">{{ .Params.LinkTitle | default .Params.Title }}</a> | ||
{{- end -}} | ||
{{ else -}} | ||
{{ $children = where .Children.ByWeight "Identifier" "ne" "all-releases-page" -}} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ range $children -}} | ||
<a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a> | ||
{{- end -}} | ||
</ul> | ||
</div> | ||
{{ else -}} | ||
{{/* | ||
Customized to allow hiding items from the navbar | ||
*/}} | ||
{{ if ne .Page.Params.top_hidden true -}} | ||
<li class="nav-item"> | ||
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} | ||
{{ $href := "" -}} | ||
{{ with .Page -}} | ||
{{ $active = or $active ( $.IsDescendant .) -}} | ||
{{ $href = .RelPermalink -}} | ||
{{ else -}} | ||
{{ $href = .URL | relLangURL -}} | ||
{{ end -}} | ||
{{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}} | ||
<a {{/**/ -}} | ||
class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}} | ||
href="{{ $href }}" | ||
{{- if $isExternal }} target="_blank" rel="noopener" {{- end -}} | ||
> | ||
{{- .Pre -}} | ||
{{ if $cover }} td-navbar-cover {{ end }}" data-bs-theme="dark"> | ||
<div class="container-fluid flex-column flex-md-row"> | ||
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"> | ||
<span class="navbar-brand__logo navbar-logo"> | ||
{{ if ne .Site.Params.ui.navbar_logo false }} | ||
{{ with resources.Get "icons/logo.svg" }} | ||
{{ (. | minify).Content | safeHTML }} | ||
{{ end }} | ||
{{ end }} | ||
</span> | ||
</a> | ||
<div class="td-navbar-nav-scroll ms-md-auto" id="main_navbar"> | ||
<ul class="navbar-nav"> | ||
{{ $p := . }} | ||
{{ $s := .Site }} | ||
{{ range .Site.Menus.main }} | ||
{{ if .HasChildren }} | ||
<!-- Menu items with children --> | ||
<div class="dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
{{ .Pre }} | ||
<span>{{ .Name }}</span> | ||
{{- .Post -}} | ||
</a> | ||
</li> | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ if .Site.Params.versions -}} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-version-selector.html" . -}} | ||
</li> | ||
{{ end -}} | ||
{{ if (gt (len .Site.Home.Translations) 0) -}} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-lang-selector.html" . -}} | ||
</li> | ||
{{ end -}} | ||
{{ if .Site.Params.ui.showLightDarkModeMenu -}} | ||
<li class="td-light-dark-menu nav-item dropdown"> | ||
{{ partial "theme-toggler" . }} | ||
</li> | ||
{{ end -}} | ||
</ul> | ||
</div> | ||
<div class="d-none d-lg-block"> | ||
{{ partial "search-input.html" . }} | ||
</a> | ||
<ul class="dropdown-menu"> | ||
{{ $children := .Children.ByWeight }} | ||
{{ if eq .Identifier "releases" }} | ||
{{ with (partial "releasePages.html" (dict "site" $s)).active }} | ||
{{ range . }} | ||
<a class="dropdown-item" href="{{ .RelPermalink }}">{{ .Params.LinkTitle | default .Params.Title }}</a> | ||
{{ end }} | ||
{{ else }} | ||
{{ $children = where .Children.ByWeight "Identifier" "ne" "all-releases-page" }} | ||
{{ end }} | ||
{{ end }} | ||
{{ range $children }} | ||
<a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a> | ||
{{ end }} | ||
</ul> | ||
</div> | ||
{{ else }} | ||
<!-- Menu items without children --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the logic for menu items without children. Other changes in this PR are mainly formatting. |
||
{{ $topHidden := false }} | ||
{{ if .Page }} | ||
{{ $topHidden = .Page.Params.top_hidden | default false }} | ||
{{ else }} | ||
{{ $topHidden = .Params.top_hidden | default false }} | ||
{{ end }} | ||
{{ if not $topHidden }} | ||
<li class="nav-item"> | ||
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }} | ||
{{ $href := "" }} | ||
{{ with .Page }} | ||
{{ $active = or $active ($p.IsDescendant .) }} | ||
{{ $href = .RelPermalink }} | ||
{{ else }} | ||
{{ $href = .URL | relLangURL }} | ||
{{ end }} | ||
{{ $siteURL := urls.Parse $s.BaseURL }} | ||
{{ $linkURL := urls.Parse $href }} | ||
{{ $isExternal := false }} | ||
{{ if and $siteURL $linkURL }} | ||
{{ $isExternal = ne $siteURL.Host $linkURL.Host }} | ||
{{ end }} | ||
<a | ||
class="nav-link{{ if $active }} active{{ end }}" | ||
href="{{ $href }}" | ||
{{ if $isExternal }} target="_blank" rel="noopener"{{ end }} | ||
> | ||
{{ .Pre }} | ||
<span>{{ .Name }}</span> | ||
{{ .Post }} | ||
</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
<!-- Other navbar items --> | ||
{{ if .Site.Params.versions }} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-version-selector.html" . }} | ||
</li> | ||
{{ end }} | ||
{{ if gt (len .Site.Home.Translations) 0 }} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-lang-selector.html" . }} | ||
</li> | ||
{{ end }} | ||
{{ if .Site.Params.ui.showLightDarkModeMenu }} | ||
<li class="td-light-dark-menu nav-item dropdown"> | ||
{{ partial "theme-toggler" . }} | ||
</li> | ||
{{ end }} | ||
</ul> | ||
</div> | ||
<div class="d-none d-lg-block"> | ||
{{ partial "search-input.html" . }} | ||
</div> | ||
</div> | ||
</div> | ||
</nav> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make "docs & releases" the first menu item.