mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-15 02:17:05 +00:00
1 parent
8f0fcba6bd
commit
452bf675ce
2 files changed
+12
-12
No files matched your search
@@ -63,19 +63,16 @@ If you need a specific template for a sub-section, you need to adjust either the
|
|||||||
With the available [section variables and methods](#section-page-variables-and-methods) you can build powerful navigation. One common example would be a partial to show Breadcrumb navigation:
|
With the available [section variables and methods](#section-page-variables-and-methods) you can build powerful navigation. One common example would be a partial to show Breadcrumb navigation:
|
||||||
|
|
||||||
{{< code file="layouts/partials/breadcrumb.html" download="breadcrumb.html" >}}
|
{{< code file="layouts/partials/breadcrumb.html" download="breadcrumb.html" >}}
|
||||||
<ol class="nav navbar-nav">
|
<ol class="nav navbar-nav">
|
||||||
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
|
<ul>
|
||||||
</ol>
|
{{- range .Ancestors.Reverse }}
|
||||||
{{ define "breadcrumbnav" }}
|
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
|
||||||
{{ if .p1.Parent }}
|
{{- end }}
|
||||||
{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }}
|
<li class="active" aria-current="page">
|
||||||
{{ else if not .p1.IsHome }}
|
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||||
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }}
|
|
||||||
{{ end }}
|
|
||||||
<li{{ if eq .p1 .p2 }} class="active" aria-current="page" {{ end }}>
|
|
||||||
<a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a>
|
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
</ul>
|
||||||
|
</ol>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
|
||||||
## Section Page Variables and Methods
|
## Section Page Variables and Methods
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
|
|||||||
.Aliases
|
.Aliases
|
||||||
: aliases of this page
|
: aliases of this page
|
||||||
|
|
||||||
|
.Ancestors
|
||||||
|
: get the ancestors of each page, simplify [breadcrumb navigation]({{< relref "content-management/sections#example-breadcrumb-navigation" >}}) implementation complexity
|
||||||
|
|
||||||
.BundleType
|
.BundleType
|
||||||
: the [bundle] type: `leaf`, `branch`, or an empty string if the page is not a bundle.
|
: the [bundle] type: `leaf`, `branch`, or an empty string if the page is not a bundle.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user