Compare commits

...

4 commits

12 changed files with 43 additions and 16 deletions

View file

@ -301,7 +301,7 @@ samp,
var,
pre {
font-family: $code-font;
font-size: 1em;
font-size: 0.9em;
word-wrap: normal;
}

View file

@ -11,7 +11,10 @@
& > article {
grid-area: page-container;
margin-block-start: 2em;
@include mq("large") {
margin-block-start: 2em;
}
}
@include mq("large") {

View file

@ -78,7 +78,15 @@
}
& > * {
inline-size: 20%;
inline-size: 100%;
@include mq("small") {
inline-size: 50%;
}
@include mq("large") {
inline-size: 20%;
}
}
& > a {

View file

@ -181,7 +181,7 @@
grid-column-end: 3;
grid-row-start: 2;
grid-row-end: 3;
padding-inline: 1em;
padding: 1em;
@include mq("large") {
grid-row-start: 1;

View file

@ -41,6 +41,10 @@
<!-- Validation -->
{{- if ( and ( isset .Params "itemType" ) ) -}}
{{- erroridf "invalid-itemtype" "`itemType` is not a valid parameter, use `itemtype` instead." -}}
{{- end -}}
{{- if ( and ( isset .Params "citeStyle" ) ( not ( in ( slice "inherit" "enquote" "normal" ) .Params.citeStyle ) ) ) -}}
{{- erroridf "invalid-citeStyle" "Invalid `citeStyle` value %q for %q" .Params.citeStyle $title -}}
{{- end -}}

View file

@ -37,6 +37,15 @@
{{- end -}}
{{- end -}}
{{- if ( and $hint ( not $isResizable ) ) -}}
{{- warnidf "pointless-hint" "Hint '%s' provided for an image that is not convertible to .webm, ignoring… (%q)" $hint $img.File.Path }}
{{- end -}}
{{- $valid_hint_values := ( slice "drawing" "icon" "photo" "picture" "text" ) -}}
{{- if ( and $hint ( not ( in $valid_hint_values $hint ) ) ) -}}
{{- errorf "Hint '%s' is not valid, use one of %q instead. (%q)" $hint $img.File.Path -}}
{{- end -}}
<!-- Rendering -->
{{- if $isResizable -}}

View file

@ -34,7 +34,7 @@
{{ if .Params.featured_image }}
style="background-image: url(
{{ with .Resources.GetMatch .Params.featured_image }}
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}}
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) . "500x" -}}
{{- else -}}
{{- warnf "Featured image %s is not a page resource" .Params.featured_image -}}
{{- .Params.featured_image -}}
@ -48,7 +48,7 @@
style="display: none;"
src="
{{- with .Resources.GetMatch .Params.featured_image -}}
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}}
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) . "500x" -}}
{{- else -}}
{{- warnf "Featured image %s is not a page resource" .Params.featured_image -}}
{{- .Params.featured_image -}}

View file

@ -3,16 +3,17 @@
@params src Image media file.
@params raw Force raw image only. Optional.
@params cacheBust Force cache busting. Optional.
-->
<!-- Variable assignment -->
{{- $src := .src -}}
{{- $hint := default ( index $src.Params "hint" ) "" }}
{{- $cacheBust := cond ( and ( isset . "cacheBust" ) .cacheBust ) "" ( md5 now.UnixNano ) -}}
{{- $format := cond ( and ( isset . "raw" ) .raw ) "" "webp" -}}
{{- $isResizable := not ( in ( slice "svg" "gif" ) $src.MediaType.SubType ) -}}
<!-- Rendering -->
<picture
@ -21,17 +22,17 @@
>
{{ if $isResizable -}}
<source
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "same" "format" $format ) $src.Title -}}"
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "same" "format" $format ) $src $cacheBust -}}"
/>
{{- if gt $src.Width 1200 -}}
<source
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "1200x" "format" $format ) ( printf "%s-1200x" $src.Title ) -}}"
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "1200x" "format" $format ) $src "1200x" $cacheBust -}}"
media="(max-width: 1200px)"
/>
{{- end -}}
{{- if gt $src.Width 800 -}}
<source
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "800x" "format" $format ) ( printf "%s-800x" $src.Title ) -}}"
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "800x" "format" $format ) $src "800x" $cacheBust -}}"
media="(max-width: 800px)"
/>
{{- end -}}
@ -41,7 +42,7 @@
{{ if not $isResizable -}}
src="{{- $src.RelPermalink -}}"
{{- else -}}
src="{{- partialCached "images/get-image.html" ( dict "img" $src "format" $format ) $src.Title -}}"
src="{{- partialCached "images/get-image.html" ( dict "img" $src "format" $format ) $src $cacheBust -}}"
width="{{- $src.Width -}}"
height="{{- $src.Height -}}"
{{- end }}

View file

@ -16,7 +16,7 @@
poster="
{{- if $src.Params.poster -}}
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
{{- partialCached "images/get-image.html" ( dict "img" $posterSrc ) $posterSrc.Title -}}
{{- partialCached "images/get-image.html" ( dict "img" $posterSrc ) $posterSrc -}}
{{- else -}}
{{- erroridf "a11y-video-poster" "No poster defined for resource %q (%q)" $src.RelPermalink .page_file_path -}}
{{- end -}}

View file

@ -20,7 +20,7 @@
style="display: none;"
src="
{{- with ( $.pc.Resources.GetMatch . ) -}}
{{- partialCached "images/get-image.html" ( dict "img" . ) .Title -}}
{{- partialCached "images/get-image.html" ( dict "img" . ) . -}}
{{- else -}}
{{- . -}}
{{- end -}}
@ -37,7 +37,7 @@
class="article-header__featured-image"
{{ with .pc.Params.featured_image }}
{{ with ( $.pc.Resources.GetMatch . ) }}
style="background-image: url({{- partialCached "images/get-image.html" ( dict "img" . ) .Title -}})"
style="background-image: url({{- partialCached "images/get-image.html" ( dict "img" . ) . -}})"
{{ else }}
{{- if $.pc.Page.Resources -}}
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" . $.pc.Page.File.Path $.pc.Page.Resources -}}

View file

@ -5,12 +5,14 @@
@params link URI or Page Resource to wrap image in. Optional.
@params rel Force relationship value. Optional.
@params raw Force raw image only. Optional.
@params cacheBust Force cache busting. Optional.
-->
<!-- Variable assignment -->
{{- $src := $.Page.Resources.GetMatch ( .Get "src" ) -}}
{{- $raw := default false ( .Get "raw" ) -}}
{{- $cacheBust := default false ( .Get "cacheBust" ) -}}
{{- $linkedResource := $.Page.Resources.GetMatch ( .Get "link" ) -}}
{{- $valid_rel_values := partialCached "util/get_valid_rel_values.html" . -}}
@ -39,7 +41,7 @@
<a href="{{- .Get "link" -}}">
{{- end -}}
{{- end -}}
{{- partial "media/picture.html" ( dict "src" $src "raw" $raw ) -}}
{{- partial "media/picture.html" ( dict "src" $src "raw" $raw "cacheBust" $cacheBust ) -}}
{{- if .Get "link" -}}
</a>
{{- end -}}

View file

@ -27,7 +27,7 @@
{{- $darkest = index (sort .Colors "Luminance") 0 -}}
{{- $lightest = index (sort .Colors "Luminance" "desc") 0 -}}
{{- end -}}
style="background-image: url({{- partialCached "images/get-image.html" ( dict "img" . ) .Title -}});
style="background-image: url({{- partialCached "images/get-image.html" ( dict "img" . ) . -}});
background-color: {{ default ( default "#fff" $lightest ) .Params.bg -}};"
{{- else -}}
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" . $.Page.File.Path $.Page.Resources -}}