mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 19:50:52 -04:00
Add documentation for the .HasShortcode function
This commit is contained in:
parent
919af9071b
commit
050ccd12b7
@ -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`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user