Skip to content
Open
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
3 changes: 3 additions & 0 deletions assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1678,4 +1678,7 @@

}

{{ with (index ( index .Site.Data .Site.Language.Lang | default .Site.Data ) "homepage" "header" "image") -}}
$header-image: "{{- . -}}";
{{- end }}
@import 'custom.scss';
57 changes: 45 additions & 12 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
{{ define "main" }}
<header>
<h2>{{ .Title }}</h2>
{{ with .Description -}}
<p>{{ . }}</p>
{{- end }}
</header>

{{- if .Params.image }}
<span class="image featured"><img src="{{ .Params.image | relURL }}" alt="{{ .Params.image_alt }}" /></span>
<header>
<h2>{{ .Title }}</h2>
{{ with .Description }}
<p>{{ . }}</p>
{{ end }}
</header>

{{ range .RegularPages }}
{{ .Render "shortblock" }}
{{ end }}
{{- if .Params.image }}
{{- $alt := .Params.image_alt | default .Title -}}
{{- with $img := resources.Get .Params.image }}
{{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" }}
<picture class="image featured">
{{- $breakpoints := slice 1920 1600 1366 900 600 360 -}}
{{- range $bp := $breakpoints }}
{{- if le $bp .Width }}
{{- with .Resize (printf "%dx %s" $bp $image_options) }}
Comment on lines +14 to +17
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this exclude sizes larger than the original image?

<source srcset="{{ .RelPermalink }}" type="{{ .MediaType.Type }}" media="(max-width: {{ $bp }}px)">
{{- end }}
{{- end }}
{{- end }}

{{- /* Fallback: full-sized optimized image */ -}}
{{- with .Resize (printf "%dx %s" .Width $image_options) }}
<img
src="{{ .RelPermalink }}"
srcset="{{- range $bp := $breakpoints -}}
{{- with $.Resize (printf "%dx %s" $bp $image_options) -}}
{{ .RelPermalink }} {{ .Width }}w,
{{- end -}}
{{- end -}}"
sizes="(max-width: 1920px) 100vw, 1920px"
alt="{{ $alt }}"
width="{{ .Width }}"
height="{{ .Height }}"
loading="lazy"
class="img-fluid" />
{{- end }}
</picture>
{{- else }}
<span class="image featured">
<img src="{{ .Params.image | relURL }}" alt="{{ $alt }}">
</span>
{{- end }}
{{ end }}

{{ range .RegularPages }}
{{ .Render "shortblock" }}
{{ end }}
{{ end }}
67 changes: 52 additions & 15 deletions layouts/_default/shortblock.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,55 @@
<section class="col-6 col-12-narrower">
<div class="box post">
<a href="{{ .RelPermalink }}" class="image left"><img src="{{ .Params.image | relURL }}" alt="{{ .Params.image_alt }}" /></a>
<div class="inner">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ if .Site.Params.show_post_dates | default true }}
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
{{ end }}
<p>
{{ with .Description }}
{{- . }}
{{- else }}
{{- .Summary }}
{{- end }}
</p>
</div>
<div class="box post">
<a href="{{ .RelPermalink }}" class="image left">
{{- $alt := .Params.image_alt | default .Title -}}
{{- with $img := resources.Get .Params.image }}
{{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" }}
{{- $breakpoints := slice 800 600 400 300 -}}
{{- $orig := $img -}}

<picture>
{{- range $bp := $breakpoints }}
{{- if le $bp $orig.Width }}
{{- with $orig.Resize (printf "%dx %s" $bp $image_options) }}
<source srcset="{{ .RelPermalink }}" type="{{ .MediaType.Type }}" media="(max-width: {{ $bp }}px)">
{{- end }}
{{- end }}
{{- end }}

{{- /* Fallback main image (max 800px) */ -}}
{{- with $orig.Resize (printf "800x %s" $image_options) }}
<img
src="{{ .RelPermalink }}"
srcset="{{- range $bp := $breakpoints -}}
{{- with $orig.Resize (printf "%dx %s" $bp $image_options) -}}
{{ .RelPermalink }} {{ .Width }}w,
{{- end -}}
{{- end -}}"
sizes="(max-width: 800px) 100vw, 300px"
alt="{{ $alt }}"
width="{{ .Width }}"
height="{{ .Height }}"
Comment on lines +30 to +31
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the exampleSite images from static/ to assets/ to test, this makes the front page block show a very tall left 10% of the image. Similar scale/size issues on the post list and post pages.
https://sec.gd/hugo/themes/arcana/dev/

loading="lazy"
class="img-fluid" />
{{- end }}
</picture>
{{- else }}
<img src="{{ .Params.image | relURL }}" alt="{{ $alt }}">
{{- end }}
</a>

<div class="inner">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ if .Site.Params.show_post_dates | default true }}
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
{{ end }}
<p>
{{ with .Description }}
{{- . }}
{{- else }}
{{- .Summary }}
{{- end }}
</p>
</div>
</div>
</section>
24 changes: 22 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,28 @@ <h2>{{ .Title }}</h2>
{{ partial "tags.html" . }}
</header>

{{- if .Params.image }}
<span class="image featured"><img src="{{ .Params.image | relURL }}" alt="{{ .Params.image_alt }}" /></span>
{{- if .Params.image -}}
<span class="image featured">
{{- $alt := .Title -}}
{{- $img := resources.Get .Params.image -}}
{{- with $img -}}
{{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" -}}
<picture>
{{ range $width := slice 1920 1600 1366 900 600 360 }}
{{ if le $width $img.Width }}
{{- with $img.Resize ( printf "%dx %s" $width $image_options ) }}
<source srcset="{{ .RelPermalink }}" type="{{- .MediaType.Type -}}" media="(max-width: {{- .Width -}}px)">
{{- end }}
{{- end }}
{{- end }}
{{- with $img.Resize ( printf "%dx%d %s" $img.Width $img.Height $image_options ) -}}
<img loading="lazy" src='{{ .RelPermalink }}' type="{{- .MediaType.Type -}}" width="{{- .Width -}}" height="{{- .Height -}}" class='img-fluid' alt='{{ $alt }}' />
{{- end -}}
</picture>
{{- else -}}
<img src="{{ .Params.image | relURL }}" alt="{{ .Params.image_alt }}" />
{{- end -}}
</span>
{{ end }}

{{- .Content }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "main.scss" . | css.Sass $options }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<link rel="stylesheet" href="{{ $style.RelPermalink }}" />
{{- partial "analytics/google-tag-manager/head.html" . -}}
{{- partial "head/custom.html" . -}}
Expand Down
17 changes: 11 additions & 6 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<script src="{{ (resources.Get "js/jquery.min.js").RelPermalink }}"></script>
<script src="{{ (resources.Get "js/jquery.dropotron.min.js").RelPermalink }}"></script>
<script src="{{ (resources.Get "js/browser.min.js").RelPermalink }}"></script>
<script src="{{ (resources.Get "js/breakpoints.min.js").RelPermalink }}"></script>
<script src="{{ (resources.Get "js/util.js").RelPermalink }}"></script>
<script src="{{ (resources.Get "js/main.js").RelPermalink }}"></script>
{{- $js := slice
(resources.Get "js/jquery.min.js")
(resources.Get "js/jquery.dropotron.min.js")
(resources.Get "js/browser.min.js")
(resources.Get "js/breakpoints.min.js")
(resources.Get "js/util.js")
(resources.Get "js/main.js")
-}}

{{- $bundle := $js | resources.Concat "js/bundle.js" | resources.Minify | resources.Fingerprint -}}
<script src="{{ $bundle.RelPermalink }}" integrity="{{ $bundle.Data.Integrity }}" crossorigin="anonymous"></script>
8 changes: 4 additions & 4 deletions static/css/font-source-sans-pro.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
font-family:"Source Sans Pro";
font-style:normal;
font-weight:300;
font-display:auto;
font-display:swap;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why swap? I assume responsiveness, but is it a best practice or solving a specific problem?

src:url(../webfonts/SourceSansPro-Light.ttf);
}
@font-face{
font-family:"Source Sans Pro";
font-style:italic;
font-weight:300;
font-display:auto;
font-display:swap;
src:url(../webfonts/SourceSansPro-LightItalic.ttf);
}
@font-face{
font-family:"Source Sans Pro";
font-style:normal;
font-weight:600;
font-display:auto;
font-display:swap;
src:url(../webfonts/SourceSansPro-SemiBold.ttf);
}
@font-face{
font-family:"Source Sans Pro";
font-style:italic;
font-weight:600;
font-display:auto;
font-display:swap;
src:url(../webfonts/SourceSansPro-SemiBoldItalic.ttf);
}