summaryrefslogtreecommitdiff
path: root/themes/hugo-book/layouts/_shortcodes/card.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--themes/hugo-book/layouts/_shortcodes/card.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/themes/hugo-book/layouts/_shortcodes/card.html b/themes/hugo-book/layouts/_shortcodes/card.html
new file mode 100644
index 0000000..086fb97
--- /dev/null
+++ b/themes/hugo-book/layouts/_shortcodes/card.html
@@ -0,0 +1,22 @@
+{{- /* remove whitespace */ -}}
+{{- with .Get "href" -}}
+{{- $destination := partial "docs/links/portable-link" (dict "Page" $.Page "Destination" .) -}}
+<a class="book-card{{ with $.Get "class" }} {{ . }}{{ end }}" href="{{ $destination | safeURL }}">
+{{- template "book-card-content" $ -}}
+</a>
+{{- else -}}
+<div class="book-card{{ with .Get "class" }} {{ . }}{{ end }}">
+{{- template "book-card-content" $ -}}
+</div>
+{{- end -}}
+
+{{- define "book-card-content" -}}
+{{- with .Get "image" -}}
+ {{- $destination := partial "docs/links/portable-image" (dict "Page" $.Page "Destination" .) -}}
+ <img src="{{ $destination | safeURL }}" />
+{{- end }}
+ <div class="markdown-inner">
+ {{ with .InnerDeindent }}{{ . }}{{ end }}
+ </div>
+{{- end -}}
+{{- /* remove whitespace */ -}}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.