Mention .Params and .Page variables in shortcode docs. Also highlight variables.

This commit is contained in:
Jorin Vogel 2014-10-01 14:51:25 +07:00 committed by spf13
parent 1614b82452
commit eeaf343a14

View file

@ -128,11 +128,11 @@ parameters named parameters work best.
**Inside the template**
To access a parameter by position the .Get method can be used.
To access a parameter by position the `.Get` method can be used.
{{ .Get 0 }}
To access a parameter by name the .Get method should be utilized
To access a parameter by name the `.Get` method should be utilized
{{ .Get "class" }}
@ -147,11 +147,15 @@ or both.
{{ or .Get "title" | .Get "alt" | if }} alt="{{ with .Get "alt"}}{{.}}{{else}}{{.Get "title"}}{{end}}"{{ end }}
If a closing shortcode is used, the variable .Inner will be populated with all
If a closing shortcode is used, the variable `.Inner` will be populated with all
of the content between the opening and closing shortcodes. If a closing
shortcode is required, you can check the length of .Inner and provide a warning
shortcode is required, you can check the length of `.Inner` and provide a warning
to the user.
The variable `.Params` contains the list of parameters in case you need to do more complicated things than `.Get`.
You can also use the variable `.Page` to access all the normal [Page Variables](/templates/variables/).
## Single Positional Example: youtube
{{% youtube 09jf3ow9jfw %}}