mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-12-24 14:59:27 +01:00
Add figure shortcode
This commit is contained in:
parent
4845a3db96
commit
aa1abb8fcd
8
layouts/shortcodes/figure.html
Normal file
8
layouts/shortcodes/figure.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{ if .Get "src" }}
|
||||
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
|
||||
<img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
|
||||
{{ if .Get "caption" }}
|
||||
<figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
@ -94,6 +94,43 @@ img {
|
||||
}
|
||||
}
|
||||
|
||||
figure {
|
||||
display: table;
|
||||
max-width: 100%;
|
||||
margin: 25px 0;
|
||||
|
||||
&.left {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
&.center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
&.right {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
font-size: 14px;
|
||||
margin-top: 5px;
|
||||
opacity: .8;
|
||||
|
||||
&.left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&.right {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;
|
||||
font-feature-settings: normal;
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user