diff options
| -rw-r--r-- | assets/css/post-single.css | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/figure.html | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/assets/css/post-single.css b/assets/css/post-single.css index b7ec47f..16a6c12 100644 --- a/assets/css/post-single.css +++ b/assets/css/post-single.css @@ -242,6 +242,10 @@ margin: auto } +.post-content figure.align-center { + text-align: center; +} + .post-content figure > figcaption { color: var(--primary); font-size: 16px; diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 71aebb1..77f188e 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,8 +1,11 @@ -<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> +<figure{{ if or (.Get "class") (eq (.Get "align") "center") }} class=" + {{- if eq (.Get "align") "center" }}align-center {{ end }} + {{- with .Get "class" }}{{ . }}{{- end }}" +{{- end -}}> {{- if .Get "link" -}} <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> {{- end }} - <img src="{{ .Get "src" }}" + <img src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}" {{- if or (.Get "alt") (.Get "caption") }} alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" {{- end -}} |
