Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/sass/contentNavigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
}
}

.o-related__item img {
.o-related__item figure {
border-radius: var(--border-radius-s);
}

Expand Down Expand Up @@ -211,7 +211,7 @@
}

main.o-newspage .o-aside {
img {
figure {
display: none;
}
}
Expand Down
4 changes: 4 additions & 0 deletions assets/sass/expander.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ details[open] > .o-expander__summary {
& > *:last-child > *:last-child > *:last-child {
margin-bottom: 0;
}

figure > figcaption {
background-color: var(--bg-default);
}
}

details {
Expand Down
4 changes: 2 additions & 2 deletions assets/sass/floatImage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
display: flow-root;
margin-bottom: 1rem;

&--right > img {
&--right > figure {
float: right;
margin-left: 2rem;
}

&--left > img {
&--left > figure {
float: left;
margin-right: 2rem;
}
Expand Down
23 changes: 20 additions & 3 deletions assets/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,27 @@ main {
}
}

img {
width: 100%;
height: auto;
figure {
border-radius: var(--border-radius-l);
margin: 0;
overflow: hidden;
display: flex;
flex-direction: column;

> img {
width: 100%;
height: auto;
}

> hr {
margin: 0;
}

> figcaption {
background-color: var(--bg-neutral);
font-size: 0.9em;
padding: 0.8rem;
}

@media print {
display: none;
Expand Down
4 changes: 2 additions & 2 deletions assets/sass/teaser.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
flex-direction: column;
}

.m-teaser__image img {
.m-teaser__image figure {
border-radius: var(--border-radius-l) 0 0 var(--border-radius-l);

@media (max-width: #{$breakpoint-md}) {
Expand Down Expand Up @@ -83,7 +83,7 @@
}
}

.m-teaser__image img {
.m-teaser__image figure {
border-radius: var(--border-radius-l) var(--border-radius-l) 0 0;
object-fit: cover;
height: 100%;
Expand Down
1 change: 1 addition & 0 deletions content/operator/euskotren/index.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Spezielles "Euskotren FIP Ticket" (für Inhaber & Angehörige): ✅
{{% float-image
src="euskotren_fip_ticket.webp"
alt="Euskotren FIP Ticket"
caption="Euskotren FIP Ticket"
width="30%"
position="left"
%}}
Expand Down
1 change: 1 addition & 0 deletions content/operator/euskotren/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Special "Euskotren FIP Ticket" (for holders & relatives): ✅
{{% float-image
src="euskotren_fip_ticket.webp"
alt="Euskotren FIP Ticket"
caption="Euskotren FIP Ticket"
width="30%"
position="left"
%}}
Expand Down
1 change: 1 addition & 0 deletions content/operator/euskotren/index.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Billets FIP 50 : ⛔ \
{{% float-image
src="euskotren_fip_ticket.webp"
alt="Euskotren FIP Ticket"
caption="Euskotren FIP Ticket"
width="30%"
position="left"
%}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
loading="lazy"
/>
{{- else -}}
{{- partial "image" (dict "image" $image) -}}
{{- partial "image" (dict "image" $image "caption" .PlainText) -}}
{{- end -}}
{{- else -}}
{{- warnf "Image resource '%s' could not be found. Used in '%s'" .Destination $.Page.File.Path -}}
Expand Down
46 changes: 28 additions & 18 deletions layouts/partials/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,34 @@
{{- end -}}
{{- $srcset = $srcset | append (printf "%s %dw" $image.RelPermalink $image.Width) -}}

{{- $styles := slice -}}
{{- $imgStyles := slice -}}
{{- if and $image.Width $image.Height -}}
{{- $styles = $styles | append (printf "aspect-ratio: %d / %d" $image.Width $image.Height) -}}
{{- $imgStyles = $imgStyles | append (printf "aspect-ratio: %d / %d" $image.Width $image.Height) -}}
{{- end -}}

{{- $figStyles := slice -}}
{{- if $width -}}
{{- $styles = $styles | append (printf "width: %s" $width) -}}
{{- end -}}


<img
src="{{ $image.RelPermalink }}"
alt="{{ .alt }}"
{{- if not .alt }}
data-decorative="true"
{{- end }}
loading="{{ $loading }}"
{{- with .fetchpriority -}}fetchpriority="{{ . }}"{{- end -}}
srcset="{{ delimit $srcset ", " }}"
sizes="(max-width: 576px) calc(100vw - 3.2rem), (max-width: 768px) 540px, (max-width: 992px) 720px, (max-width: 1200px) 960px, (max-width: 1400px) 1140px, 1320px"
style="{{ delimit $styles "; " | safeCSS }}"
/>
{{- $figStyles = $figStyles | append (printf "width: %s" $width) -}}
{{- end -}}


<figure style="{{ delimit $figStyles "; " | safeCSS }}">
<img
src="{{ $image.RelPermalink }}"
alt="{{ .alt }}"
{{- if not .alt }}
data-decorative="true"
{{- end }}
loading="{{ $loading }}"
{{- with .fetchpriority -}}fetchpriority="{{ . }}"{{- end -}}
srcset="{{ delimit $srcset ", " }}"
sizes="(max-width: 576px) calc(100vw - 3.2rem), (max-width: 768px) 540px, (max-width: 992px) 720px, (max-width: 1200px) 960px, (max-width: 1400px) 1140px, 1320px"
style="{{ delimit $imgStyles "; " | safeCSS }}"
/>
{{- if .caption -}}
<hr aria-hidden="true" />
<figcaption>
{{ .caption }}
</figcaption>
{{- end -}}
</figure>
2 changes: 2 additions & 0 deletions layouts/shortcodes/float-image.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $image := $.Page.Resources.GetMatch (.Get "src") -}}
{{- $alt := .Get "alt" -}}
{{- $caption := .Get "caption" -}}
{{- $width := .Get "width" | default "50%" -}}
{{- $position := .Get "position" | default "right" -}}

Expand All @@ -9,6 +10,7 @@
(dict
"image" $image
"alt" $alt
"caption" $caption
"width" $width
)
-}}
Expand Down
Loading