mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -6,8 +6,7 @@ categories: [functions]
|
||||
keywords: ['front matter', 'params']
|
||||
menu:
|
||||
docs:
|
||||
parent: 'functions'
|
||||
aliases: []
|
||||
parent: functions
|
||||
---
|
||||
|
||||
The `.Param` method on `.Page` looks for the given `KEY` in page parameters, and returns the corresponding value. If it cannot find the `KEY` in page parameters, it looks for the `KEY` in site parameters. If it cannot find the `KEY` in either location, the `.Param` method returns `nil`.
|
||||
@@ -25,8 +24,8 @@ display_toc = true
|
||||
|
||||
**Content**
|
||||
|
||||
{{< code-toggle file="content/about.md" fm=true copy=false >}}
|
||||
title = 'About'
|
||||
{{< code-toggle file="content/example.md" fm=true copy=false >}}
|
||||
title = 'Example'
|
||||
date = 2023-01-01
|
||||
draft = false
|
||||
display_toc = false
|
||||
@@ -34,7 +33,7 @@ display_toc = false
|
||||
|
||||
**Template**
|
||||
|
||||
{{< code file="layouts/_default/single.html" copy="false" >}}
|
||||
{{< code file="layouts/_default/single.html" copy=false >}}
|
||||
{{ if .Param "display_toc" }}
|
||||
{{ .TableOfContents }}
|
||||
{{ end }}
|
||||
@@ -42,6 +41,6 @@ display_toc = false
|
||||
|
||||
The `.Param` method returns the value associated with the given `KEY`, regardless of whether the value is truthy or falsy. If you need to ignore falsy values, use this construct instead:
|
||||
|
||||
{{< code file="layouts/_default/single.html" copy="false" >}}
|
||||
{{< code file="layouts/_default/single.html" copy=false >}}
|
||||
{{ or .Params.foo site.Params.foo }}
|
||||
{{< /code >}}
|
||||
|
Reference in New Issue
Block a user