diff --git a/exampleSite/content/docs/guide/shortcodes/others.md b/exampleSite/content/docs/guide/shortcodes/others.md index 8c96e65..37ce56f 100644 --- a/exampleSite/content/docs/guide/shortcodes/others.md +++ b/exampleSite/content/docs/guide/shortcodes/others.md @@ -34,16 +34,15 @@ Result: {{< badge content="warning" type="warning" >}} {{< badge content="error" type="error" >}} -With link: +With link and icon: ``` -{{* badge content="Releases" link="https://github.com/imfing/hextra/releases" */>}} +{{* badge content="Releases" link="https://github.com/imfing/hextra/releases" icon="github" */>}} ``` Result: -{{< badge content="Releases" link="https://github.com/imfing/hextra/releases" >}} - +{{< badge content="Releases" link="https://github.com/imfing/hextra/releases" icon="github" >}} ## YouTube diff --git a/exampleSite/layouts/shortcodes/new-feature.html b/exampleSite/layouts/shortcodes/new-feature.html new file mode 100644 index 0000000..fadf7ec --- /dev/null +++ b/exampleSite/layouts/shortcodes/new-feature.html @@ -0,0 +1,11 @@ +{{- $version := .Get "version" | default "" -}} +{{- $icon := .Get "icon" | default "" -}} +{{- $defaultLink := cond (eq $version "") "https://github.com/imfing/hextra/tree/main" (printf "https://github.com/imfing/hextra/releases/tag/%s" $version) -}} +{{- $link := .Get "link" | default $defaultLink -}} +{{- $content := cond (eq $version "") "New in main branch" (printf "New in %s" $version) -}} + +
diff --git a/layouts/partials/shortcodes/badge.html b/layouts/partials/shortcodes/badge.html index 3e249d7..38d9166 100644 --- a/layouts/partials/shortcodes/badge.html +++ b/layouts/partials/shortcodes/badge.html @@ -2,6 +2,7 @@ {{- $type := .type -}} {{- $class := .class | default "" -}} {{- $border := .border | default false -}} +{{- $icon := .icon | default "" -}} {{- $defaultClass := "hx-text-gray-600 hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200 hx-border-gray-200 dark:hx-border-neutral-700" -}} {{- $warningClass := "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" -}} @@ -11,6 +12,9 @@ {{- $borderClass := cond (eq $border true) "hx-border" "" -}} {{- $badgeClass := cond (eq $type "info") $infoClass (cond (eq $type "warning") $warningClass (cond (eq $type "error") $errorClass $defaultClass)) -}}