Parent
Syntax
SHORTCODE.Parent
Returns
hugolib.ShortcodeWithPage
This is useful for inheritance of common shortcode parameters from the root.
In this contrived example, the “greeting” shortcode is the parent, and the “now” shortcode is child.
content/welcome.md
{{< greeting dateFormat="Jan 2, 2006" >}}
Welcome. Today is {{< now >}}.
{{< /greeting >}}layouts/shortcodes/greeting.html
<div class="greeting">
  {{ trim .Inner "\r\n" | .Page.RenderString }}
</div>layouts/shortcodes/now.html
{{- $dateFormat := "January 2, 2006 15:04:05" }}
{{- with .Params }}
  {{- with .dateFormat }}
    {{- $dateFormat = . }}
  {{- end }}
{{- else }}
  {{- with .Parent.Params }}
    {{- with .dateFormat }}
      {{- $dateFormat = . }}
    {{- end }}
  {{- end }}
{{- end }}
{{- now | time.Format $dateFormat -}}The “now” shortcode formats the current time using:
- The 
dateFormatparameter passed to the “now” shortcode, if present - The 
dateFormatparameter passed to the “greeting” shortcode, if present - The default layout string defined at the top of the shortcode