diff --git a/exampleSite/content/shortcodes/notice.en.md b/exampleSite/content/shortcodes/notice.en.md index 6a5ec9d2ff..e02110d00a 100644 --- a/exampleSite/content/shortcodes/notice.en.md +++ b/exampleSite/content/shortcodes/notice.en.md @@ -8,11 +8,15 @@ The notice shortcode shows four types of disclaimers to help you structure your ## Usage ````go -{{%/* notice [ note | info | tip | warning ] */%}} +{{%/* notice [ note | info | tip | warning ] [?string] */%}} Some markup {{%/* /notice */%}} ```` +The first parameter is required and indicates the type of notice. + +The second parameter is optional. If provided, it will be used as the title of the notice. If not provided, then the type of notice will be used as the title. For example, the title of a warning notice will be "Warning". + ## Examples ### Note @@ -190,3 +194,17 @@ You can add: {{%/* /notice */%}} ```` {{% /expand %}} + +### Notice with Custom Title + +You can customize the title of the notice by passing it as a second parameter. + +````go +{{%/* notice note "Pay Attention to this Note!" */%}} +The title is now the parameter that was provided. +{{%/* /notice */%}} +```` + +{{% notice note "Pay Attention to this Note!" %}} +The title is now the parameter that was provided. +{{% /notice %}} diff --git a/layouts/shortcodes/notice.html b/layouts/shortcodes/notice.html index b5783a7b66..c8f773d44e 100644 --- a/layouts/shortcodes/notice.html +++ b/layouts/shortcodes/notice.html @@ -1,6 +1,6 @@ {{- $_hugo_config := `{ "version": 1 }` }} {{- $style := .Get 0 }} -{{- $title := $style | T }} +{{- $title := .Get 1 | default ($style | T) }}