From 3a216186b2cfa479c250dabb64eff022a388fb40 Mon Sep 17 00:00:00 2001 From: Septs Date: Wed, 30 Nov 2022 12:02:57 +0800 Subject: resource/page: Add Page.Ancestors Fixes #10567 --- docs/content/en/content-management/sections.md | 21 +++++++++------------ docs/content/en/variables/page.md | 3 +++ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'docs/content') diff --git a/docs/content/en/content-management/sections.md b/docs/content/en/content-management/sections.md index 5ff884610..b68a5bdb9 100644 --- a/docs/content/en/content-management/sections.md +++ b/docs/content/en/content-management/sections.md @@ -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: {{< code file="layouts/partials/breadcrumb.html" download="breadcrumb.html" >}} - -{{ define "breadcrumbnav" }} -{{ if .p1.Parent }} -{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }} -{{ else if not .p1.IsHome }} -{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }} -{{ end }} - - {{ .p1.Title }} + {{< /code >}} ## Section Page Variables and Methods diff --git a/docs/content/en/variables/page.md b/docs/content/en/variables/page.md index 07acc4831..2de54ff8b 100644 --- a/docs/content/en/variables/page.md +++ b/docs/content/en/variables/page.md @@ -32,6 +32,9 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables. .Aliases : aliases of this page +.Ancestors +: get the ancestors of each page, simplify [breadcrumb navigation]({{< relref "content-management/sections#example-breadcrumb-navigation" >}}) implementation complexity + .BundleType : the [bundle] type: `leaf`, `branch`, or an empty string if the page is not a bundle. -- cgit v1.2.3