mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-12-22 04:13:17 -06:00
Improve figures
- Add option to disable border and caption
This commit is contained in:
parent
0cfecdab18
commit
7ffa6c068c
@ -112,7 +112,7 @@ img, video {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
img:not(.noborder), video:not(.noborder) {
|
||||
figure.border img, figure.border video {
|
||||
padding: 5px;
|
||||
border: 7px solid #1b5b9b;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
{{ with .Resources.GetMatch "feature" }}
|
||||
<div class="post-media">
|
||||
{{ partial "figure.html" . }}
|
||||
{{ partial "figure.html" (dict "src" . "border" true) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
{{ with .Resources.GetMatch "feature" }}
|
||||
<div class="post-media">
|
||||
{{ partial "figure.html" . }}
|
||||
{{ partial "figure.html" (dict "src" . "border" true) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,4 +1,12 @@
|
||||
{{ $hidecaption := index . "hidecaption" }}
|
||||
|
||||
{{ if index . "border" }}
|
||||
<figure class="border">
|
||||
{{ else }}
|
||||
<figure>
|
||||
{{ end }}
|
||||
{{ with index . "src" }}
|
||||
|
||||
{{ $media := . | resources.Fingerprint "sha512" }}
|
||||
{{ if eq .MediaType.MainType "image" }}
|
||||
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
||||
@ -9,9 +17,13 @@
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ if not $hidecaption }}
|
||||
{{ with $media.Title }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</figure>
|
||||
|
@ -1,2 +1,15 @@
|
||||
{{ $resource := $.Page.Resources.GetMatch (.Get "src") }}
|
||||
{{ partial "figure.html" $resource }}
|
||||
|
||||
{{ $border := false }}
|
||||
{{ if .Get "border" }}
|
||||
{{ $border = true }}
|
||||
{{ end }}
|
||||
|
||||
{{ $hidecaption := false }}
|
||||
{{ if .Get "hidecaption" }}
|
||||
{{ $hidecaption = true }}
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
{{ partial "figure.html" (dict "src" $resource "border" $border "hidecaption" $hidecaption) }}
|
||||
</p>
|
||||
|
Loading…
Reference in New Issue
Block a user