mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -56,43 +56,39 @@ If true, the page will be treated as part of the project's collections and, when
|
||||
|
||||
#### publishResources
|
||||
|
||||
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
|
||||
If set to true the [Bundle's Resources](/content-management/page-bundles) will be published.
|
||||
Setting this to false will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.
|
||||
|
||||
{{% note %}}
|
||||
Any page, regardless of their build options, will always be available using the [`.GetPage`]({{< relref "functions/GetPage" >}}) methods.
|
||||
Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/getpage) methods.
|
||||
{{% /note %}}
|
||||
|
||||
------
|
||||
|
||||
### Illustrative use cases
|
||||
|
||||
#### Not publishing a page
|
||||
|
||||
Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else.
|
||||
|
||||
```yaml
|
||||
# content/who-we-are.md`
|
||||
{{< code-toggle file="content/who-we-are.md" fm=true copy=false >}}
|
||||
title: Who we are
|
||||
_build:
|
||||
list: false
|
||||
render: false
|
||||
```
|
||||
{{< /code-toggle >}}
|
||||
|
||||
```go-html-template
|
||||
{{/* layouts/index.html */}}
|
||||
{{< code file="layouts/index.html" copy=false >}}
|
||||
<section id="who-we-are">
|
||||
{{ with site.GetPage "who-we-are" }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
{{ with site.GetPage "who-we-are" }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
</section>
|
||||
```
|
||||
{{< /code >}}
|
||||
|
||||
#### Listing pages without publishing them
|
||||
|
||||
Website needs to showcase a few of the hundred "testimonials" available as content files without publishing any of them.
|
||||
|
||||
To avoid setting the build options on every testimonials, one can use [`cascade`]({{< relref "/content-management/front-matter#front-matter-cascade" >}}) on the testimonial section's content file.
|
||||
To avoid setting the build options on every testimonials, one can use [`cascade`](/content-management/front-matter#front-matter-cascade) on the testimonial section's content file.
|
||||
|
||||
{{< code-toggle >}}
|
||||
title: Testimonials
|
||||
@@ -104,12 +100,12 @@ cascade:
|
||||
list: true # default
|
||||
{{< /code-toggle >}}
|
||||
|
||||
```go-html-template
|
||||
{{/* layouts/_defaults/testimonials.html */}}
|
||||
{{< code file="layouts/_defaults/testimonials.html" copy=false >}}
|
||||
<section id="testimonials">
|
||||
{{ range first 5 .Pages }}
|
||||
<blockquote cite="{{ .Params.cite }}">
|
||||
{{ .Content }}
|
||||
</blockquote>
|
||||
{{ end }}
|
||||
{{ range first 5 .Pages }}
|
||||
<blockquote cite="{{ .Params.cite }}">
|
||||
{{ .Content }}
|
||||
</blockquote>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{< /code >}}
|
||||
|
Reference in New Issue
Block a user