mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-12-22 12:13:19 -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%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
img:not(.noborder), video:not(.noborder) {
|
figure.border img, figure.border video {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 7px solid #1b5b9b;
|
border: 7px solid #1b5b9b;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
{{ with .Resources.GetMatch "feature" }}
|
{{ with .Resources.GetMatch "feature" }}
|
||||||
<div class="post-media">
|
<div class="post-media">
|
||||||
{{ partial "figure.html" . }}
|
{{ partial "figure.html" (dict "src" . "border" true) }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
{{ with .Resources.GetMatch "feature" }}
|
{{ with .Resources.GetMatch "feature" }}
|
||||||
<div class="post-media">
|
<div class="post-media">
|
||||||
{{ partial "figure.html" . }}
|
{{ partial "figure.html" (dict "src" . "border" true) }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
|
{{ $hidecaption := index . "hidecaption" }}
|
||||||
|
|
||||||
|
{{ if index . "border" }}
|
||||||
|
<figure class="border">
|
||||||
|
{{ else }}
|
||||||
<figure>
|
<figure>
|
||||||
|
{{ end }}
|
||||||
|
{{ with index . "src" }}
|
||||||
|
|
||||||
{{ $media := . | resources.Fingerprint "sha512" }}
|
{{ $media := . | resources.Fingerprint "sha512" }}
|
||||||
{{ if eq .MediaType.MainType "image" }}
|
{{ if eq .MediaType.MainType "image" }}
|
||||||
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
||||||
@ -9,9 +17,13 @@
|
|||||||
</video>
|
</video>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not $hidecaption }}
|
||||||
{{ with $media.Title }}
|
{{ with $media.Title }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
{{ . | markdownify }}
|
{{ . | markdownify }}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
</figure>
|
</figure>
|
||||||
|
@ -1,2 +1,15 @@
|
|||||||
{{ $resource := $.Page.Resources.GetMatch (.Get "src") }}
|
{{ $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