mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-31 03:45:24 +01:00 
			
		
		
		
	init feat Breadcrumb Navigation (#207)
* adds Breadcrumb nav above title of single page/post
* add enabler var 'ShowBreadCrumbs'
* introduce i18n var "home"
usage:
in site config:
Params:
    ShowBreadCrumbs: true
in page front-matter:
ShowBreadCrumbs: false
			
			
This commit is contained in:
		| @@ -12,7 +12,8 @@ | |||||||
|     margin-bottom: 5px; |     margin-bottom: 5px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .post-meta { | .post-meta, | ||||||
|  | .breadcrumbs { | ||||||
|     color: var(--secondary); |     color: var(--secondary); | ||||||
|     font-size: 14px; |     font-size: 14px; | ||||||
|     display: flex; |     display: flex; | ||||||
| @@ -26,6 +27,10 @@ | |||||||
|     box-shadow: 0 1px 0 var(--secondary) |     box-shadow: 0 1px 0 var(--secondary) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .breadcrumbs a { | ||||||
|  |     font-size: 16px; | ||||||
|  | } | ||||||
|  |  | ||||||
| .post-content { | .post-content { | ||||||
|     color: var(--content) |     color: var(--content) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,3 +14,6 @@ | |||||||
|  |  | ||||||
| - id: translations | - id: translations | ||||||
|   translation: "Translations" |   translation: "Translations" | ||||||
|  |  | ||||||
|  | - id: home | ||||||
|  |   translation: "Home" | ||||||
|   | |||||||
| @@ -2,6 +2,24 @@ | |||||||
|  |  | ||||||
| <article class="post-single"> | <article class="post-single"> | ||||||
|   <header class="post-header"> |   <header class="post-header"> | ||||||
|  |     {{- if (.Param "ShowBreadCrumbs")}} | ||||||
|  |     <div class="breadcrumbs"> | ||||||
|  |       {{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} | ||||||
|  |       {{- $lang_url := replace $url ( printf "%s" .Lang) "" }} | ||||||
|  |  | ||||||
|  |       <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a> | ||||||
|  |       {{- range $index, $element := split $lang_url "/" }} | ||||||
|  |  | ||||||
|  |       {{- $.Scratch.Add "path" (printf "%s/" $element )}} | ||||||
|  |       {{- $bc_pg := $.Site.GetPage ($.Scratch.Get "path") -}} | ||||||
|  |  | ||||||
|  |       {{- if (and ($bc_pg) (gt (len . ) 0))}} | ||||||
|  |       {{- print " » " | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a> | ||||||
|  |       {{- end }} | ||||||
|  |  | ||||||
|  |       {{- end }} | ||||||
|  |     </div> | ||||||
|  |     {{- end }} | ||||||
|     <h1 class="post-title"> |     <h1 class="post-title"> | ||||||
|       {{ .Title }} |       {{ .Title }} | ||||||
|       {{- if .Draft }}<div class="entry-isdraft"><sup>  [draft]</sup></div>{{- end }} |       {{- if .Draft }}<div class="entry-isdraft"><sup>  [draft]</sup></div>{{- end }} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange