Introduce Badge shortcode

This commit is contained in:
Alex Shpak
2025-08-04 01:17:28 +02:00
parent 2b0d7ffa26
commit 470d619e1d
6 changed files with 101 additions and 21 deletions
+12
View File
@@ -0,0 +1,12 @@
{{- $style := default "default" (.Get "style") -}}
{{- if .Get "href" }}
<a href="{{ .Get "href" }}" target="_blank" class="book-badge {{ $style }}">
{{- with .Get "title" }}<span class="book-badge-title">{{ . | plainify }}</span>{{ end -}}
{{- with .Get "value" }}<span class="book-badge-value">{{ . | plainify }}</span>{{ end -}}
</a>
{{ else }}
<span class="book-badge {{ $style }}">
{{- with .Get "title" }}<span class="book-badge-title">{{ . | plainify }}</span>{{ end -}}
{{- with .Get "value" }}<span class="book-badge-value">{{ . | plainify }}</span>{{ end -}}
</span>
{{ end -}}
+1 -1
View File
@@ -1,3 +1,3 @@
<blockquote class="book-hint {{ .Get 0 }}">
<blockquote class="book-hint {{ default "default" (.Get 0) }}">
{{ .Inner | safeHTML }}
</blockquote>