mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
b239595af5
501c6e233 Remoe speakerdeck example 9529bd27d Fix typos 530f22cd3 Remove language assuming knowledge of GitHub OAuth c618809e7 Refer to Go by its proper name, not its domain name 06e23168b Add timeout parameter to configuration docs 034fa62a7 Update shortcodes.md 10ea79335 Document .Ordinal on shortcode 0bfd85fb9 Formatting e44f80fdf Release 0.41 76164258c releaser: Add release notes to /docs for release of 0.41 8d87505eb releaser: Bump versions for release of 0.41 2bbc003ee docs: Document the GDPR Privacy Config e2d11564d Merge commit 'd2b1030060d3c91d5f9ffa3456418da16bd74f1d' git-subtree-dir: docs git-subtree-split: 501c6e23370fae21e2110e0d7ea0db6731b31779
39 lines
1.3 KiB
Markdown
39 lines
1.3 KiB
Markdown
---
|
|
title: Shortcode Variables
|
|
linktitle: Shortcode Variables
|
|
description: Shortcodes can access page variables and also have their own specific built-in variables.
|
|
date: 2017-03-12
|
|
publishdate: 2017-03-12
|
|
lastmod: 2017-03-12
|
|
categories: [variables and params]
|
|
keywords: [shortcodes]
|
|
draft: false
|
|
menu:
|
|
docs:
|
|
parent: "variables"
|
|
weight: 20
|
|
weight: 20
|
|
sections_weight: 20
|
|
aliases: []
|
|
toc: false
|
|
---
|
|
|
|
[Shortcodes][shortcodes] have access to parameters delimited in the shortcode declaration via [`.Get`][getfunction], page- and site-level variables, and also the following shortcode-specific fields:
|
|
|
|
.Ordinal
|
|
: Zero-based ordinal in relation to its parent. If the parent is the page itself, this ordinal will represent the position of this shortcode in the page content.
|
|
|
|
.Parent
|
|
: provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root.
|
|
|
|
.IsNamedParams
|
|
: boolean that returns `true` when the shortcode in question uses [named rather than positional parameters][shortcodes]
|
|
|
|
.Inner
|
|
: represents the content between the opening and closing shortcode tags when a [closing shortcode][markdownshortcode] is used
|
|
|
|
[getfunction]: /functions/get/
|
|
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
|
|
[shortcodes]: /templates/shortcode-templates/
|
|
|
|
|