diff --git a/exampleSite/content/basics/history/_index.en.md b/exampleSite/content/basics/history/_index.en.md index 736b1192e6..8c4403e56a 100644 --- a/exampleSite/content/basics/history/_index.en.md +++ b/exampleSite/content/basics/history/_index.en.md @@ -3,4 +3,4 @@ disableToc = false title = "History" weight = 30 +++ -{{% include "basics/CHANGELOG.md" false %}} +{{% include "basics/CHANGELOG.md" true %}} diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index 282cfa8aee..bc3132c535 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -16,6 +16,10 @@ This document shows you what's new in the latest release. For a detailed list of ## 4.2.0 +- **Breaking**: The second parameter for the [`include` shortcode]({{% relref "shortcodes/tabs" %}}) was switched in meaning and was renamed from `showfirstheading` to `hidefirstheading`. If you haven't used this parameter in your shortcode, the default behavior hasn't changed and you don't need to change anything. + + If you've used the second boolean parameter, you have to rename it and invert its value to achive the same behavior. + - **Change**: Previously, if the [`tabs` shortcode]({{% relref "shortcodes/tabs" %}}) could not find a tab item because, the tabs ended up empty. Now the first tab is selected instead. - **New**: All shortcodes can now be also called from your partials. Examples for this are added to the documentation of each shortcode. diff --git a/exampleSite/content/shortcodes/include.en.md b/exampleSite/content/shortcodes/include.en.md index e667482c80..24154cfde9 100644 --- a/exampleSite/content/shortcodes/include.en.md +++ b/exampleSite/content/shortcodes/include.en.md @@ -12,7 +12,6 @@ While the examples are using shortcodes with named parameter you are free to use {{< tabs groupId="shortcode-parameter">}} {{% tab name="shortcode" %}} - ````go {{%/* include file="shortcodes/INCLUDE_ME.md" */%}} ```` @@ -44,7 +43,7 @@ The included files can even contain Markdown and will be taken into account when | Name | Position | Default | Notes | |:---------------------|:---------|:-----------------|:------------| | **file** | 1 | _<empty>_ | The path to the file to be included. Path resolution adheres to [Hugo's build-in `readFile` function](https://gohugo.io/functions/readfile/) | -| **showfirstheading** | 2 | `true` | When `false` and the included file contains headings, the first heading will be hidden. This comes in handy, eg. if you include otherwise standalone Markdown files. | +| **hidefirstheading** | 2 | `false` | When `true` and the included file contains headings, the first heading will be hidden. This comes in handy, eg. if you include otherwise standalone Markdown files. | ## Examples diff --git a/layouts/partials/shortcodes/include.html b/layouts/partials/shortcodes/include.html index 11c78ca9ce..11586594ac 100644 --- a/layouts/partials/shortcodes/include.html +++ b/layouts/partials/shortcodes/include.html @@ -1,13 +1,13 @@ {{- $context := .context }} {{- $file := .file }} -{{- $showFirstHeading := .showfirstheading | default true }} -{{- if eq (printf "%T" $showFirstHeading) "string" }} - {{- $showFirstHeading = (eq $showFirstHeading "true") }} +{{- $hideFirstHeading := .hidefirstheading | default false }} +{{- if eq (printf "%T" $hideFirstHeading) "string" }} + {{- $hideFirstHeading = (eq $hideFirstHeading "true") }} {{- end }} -{{- if not $showFirstHeading }}
{{ end }} +{{- if $hideFirstHeading }}
{{ end }} {{- with $context }} {{ $file | readFile | safeHTML }} -{{- if not $showFirstHeading }}
{{ end }} +{{- if $hideFirstHeading }}
{{ end }} {{- end }} \ No newline at end of file diff --git a/layouts/shortcodes/include.html b/layouts/shortcodes/include.html index d316b40a0f..caf458ceb6 100644 --- a/layouts/shortcodes/include.html +++ b/layouts/shortcodes/include.html @@ -1,5 +1,7 @@ +@@{{ (.Get "hidefirstheading" | default (.Get 1)) | humanize}}@ + {{- partial "shortcodes/include.html" (dict "context" . - "file" (.Get "align" | default (.Get 0)) - "showFirstHeading" (.Get "showfirstheading" | default (.Get 1)) + "file" (.Get "file" | default (.Get 0)) + "hidefirstheading" (.Get "hidefirstheading" | default (.Get 1)) ) }} \ No newline at end of file