From 050ccd12b76ff2c04476de166a29c29dce4f5aa2 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Wed, 10 Jan 2018 18:36:14 +0100 Subject: [PATCH] Add documentation for the .HasShortcode function --- content/templates/shortcode-templates.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/templates/shortcode-templates.md b/content/templates/shortcode-templates.md index 31e866414..de1594281 100644 --- a/content/templates/shortcode-templates.md +++ b/content/templates/shortcode-templates.md @@ -137,6 +137,10 @@ You can also use the variable `.Page` to access all the normal [page variables][ A shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with [`.Parent` variable][shortcodesvars]. This can be very useful for inheritance of common shortcode parameters from the root. +### Checking for Existence + +You can check if a specific shortcode is used on a page by calling `.HasShortcode` in that page template, providing the name of the shortcode. This is sometimes useful when you want to include specific scripts or styles in the header that are only used by that shortcode. + ## Custom Shortcode Examples The following are examples of the different types of shortcodes you can create via shortcode template files in `/layouts/shortcodes`.