Introduce expandable image shortcode, improve portable links logic

This commit is contained in:
Alex Shpak
2025-09-08 20:04:04 +02:00
parent dbaaa516e8
commit 249682f9dd
13 changed files with 191 additions and 68 deletions
+7 -5
View File
@@ -1,17 +1,19 @@
{{- /* remove whitespace */ -}}
{{- if .Get "href" -}}
<a class="book-card{{ with .Get "class" }} {{ . }}{{ end }}"{{ with .Get "href" }} href="{{ . | relURL }}"{{ end }}>
{{- template "book-card-content" . -}}
{{- 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" . -}}
{{- template "book-card-content" $ -}}
</div>
{{- end -}}
{{- define "book-card-content" -}}
{{- with .Get "image" -}}
<img src="{{ . | urls.RelLangURL }}" />
{{- $destination := partial "docs/links/portable-image" (dict "Page" $.Page "Destination" .) -}}
<img src="{{ $destination | safeURL }}" />
{{- end }}
<div class="markdown-inner">
{{ with .InnerDeindent }}{{ . }}{{ end }}