Make things fail hard and be easy to use.
go-html-template
Use go-html-template
for syntax highlighting of shortcodes.
Bundles
Always use index.md
or _index.md
when using resource bundles. For shortcodes requiring getting resources, fail hard. When expecting an image in a figure shortcode, simply fail with an error if that shortcode is not used in a leaf or branch bundle.
{{/* Create a error if this is not a part of a bundle */}}
{{ if and (ne .Page.BundleType "leaf") (ne .Page.BundleType "branch" ) }}
{{ errorf "Bundle for page %s is neither branch/leaf. Rename to _index.md or index.md." .Page.File.Path }}
{{ end }}
Using this snippet
Be liberal in using errorf
and warnf
where necessary.
Multiple parameters to a partial
Two or more parameters must be joined into one parameter. dict
can be used for that purpose.
See Also
- - Hugo Snippets
- - Mermaid Test
- - Is C++ your favorite programing language?
- - A Man With No Arms
- - Default explicit equality operator
Comments
Any comments? Create a new discussion on GitHub.There used to be an inline comment form here, but it was removed.