mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-30 19:35:26 +01:00 
			
		
		
		
	menu : add menu location indicator
credits for fix with [.IsMenuCurrent](https://gohugo.io/functions/ismenucurrent/): https://stackoverflow.com/a/56454338
This commit is contained in:
		| @@ -12,14 +12,19 @@ | ||||
|         {{- else }} | ||||
|         <p class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></p> | ||||
|         {{- end }} | ||||
|         {{- if .Site.Menus.main }} | ||||
|         {{ $currentPage := . }} | ||||
|         <ul class="menu" id="menu" onscroll="menu_on_scroll()"> | ||||
|             {{- range .Site.Menus.main }} | ||||
|             {{ $menu_item_url := .URL | relLangURL }} | ||||
|             {{ $page_url:= $currentPage.RelPermalink | relLangURL }} | ||||
|             <li> | ||||
|                 <a href="{{ .URL | absLangURL}}">{{ .Name }}</a> | ||||
|                 <a href="{{ .URL | absLangURL }}"> | ||||
|                     <span {{ if eq $menu_item_url $page_url }} | ||||
|                         {{/* the menu item links to the current page (with relLangURL) */}} class="active" | ||||
|                         {{ end }}>{{ .Name }}</span> | ||||
|                 </a> | ||||
|             </li> | ||||
|             {{- end }} | ||||
|         </ul> | ||||
|         {{- end }} | ||||
|     </nav> | ||||
| </header> | ||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange