mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-17 13:25:57 -06:00
Add a few new shortcodes
This commit is contained in:
parent
33fbcac9d5
commit
550bfb6367
27
layouts/partials/remote_figure.html
Normal file
27
layouts/partials/remote_figure.html
Normal file
@ -0,0 +1,27 @@
|
||||
{{ $hidecaption := index . "hidecaption" }}
|
||||
{{ $type := index . "type" }}
|
||||
{{ $src := index . "src" }}
|
||||
{{ $alt := index . "alt" }}
|
||||
|
||||
{{ if index . "border" }}
|
||||
<figure class="border">
|
||||
{{ else }}
|
||||
<figure>
|
||||
{{ end }}
|
||||
{{ if eq $type "image" }}
|
||||
<img src="{{ $src }}" alt="{{ $alt }}" />
|
||||
{{ else if eq $type "video" }}
|
||||
<video controls>
|
||||
<source src="{{ $src }}" alt="{{ $alt }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ if not $hidecaption }}
|
||||
{{ with $alt }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</figure>
|
13
layouts/shortcodes/image.html
Normal file
13
layouts/shortcodes/image.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{ $border := false }}
|
||||
{{ if .Get "border" }}
|
||||
{{ $border = true }}
|
||||
{{ end }}
|
||||
|
||||
{{ $hidecaption := false }}
|
||||
{{ if .Get "hidecaption" }}
|
||||
{{ $hidecaption = true }}
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
{{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "image" "alt" (.Get "alt")) }}
|
||||
</p>
|
13
layouts/shortcodes/video.html
Normal file
13
layouts/shortcodes/video.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{ $border := false }}
|
||||
{{ if .Get "border" }}
|
||||
{{ $border = true }}
|
||||
{{ end }}
|
||||
|
||||
{{ $hidecaption := false }}
|
||||
{{ if .Get "hidecaption" }}
|
||||
{{ $hidecaption = true }}
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
{{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "video" "alt" (.Get "alt")) }}
|
||||
</p>
|
Loading…
Reference in New Issue
Block a user