docs/content/en/methods/shortcode/Parent.md
This is useful for inheritance of common shortcode arguments from the root.
In this contrived example, the "greeting" shortcode is the parent, and the "now" shortcode is child.
{{</* greeting dateFormat="Jan 2, 2006" */>}}
Welcome. Today is {{</* now */>}}.
{{</* /greeting */>}}
<div class="greeting">
{{ .Inner | strings.TrimSpace | .Page.RenderString }}
</div>
{{- $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:
dateFormat argument passed to the "now" shortcode, if presentdateFormat argument passed to the "greeting" shortcode, if present