Compare commits

...
Author SHA1 Message Date
JimmyandGitHub cfcdb20d17 refactor: remove custom scrollbar styles and related variables (#1304) 2026-03-08 13:23:23 +01:00
0c941ebb04 fix: skip inaccessible images to avoid build failure (#1301)
* skip inaccessible images to avoid build failure

* undo changes to $result and $local

* fix: initialize $resource as a dictionary instead of an empty string

* feat: add external image processing timeout configuration

---------

Co-authored-by: Jimmy Cai <jimmy@cai.im>
2026-03-08 13:18:21 +01:00
JimmyandGitHub f13c478718 fix: check if resource exists before accessing .RelPermalink (#1299)
* fix: check if resource exists before accessing `.RelPermalink`

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/1297

* Set default value of $result in `helper/image` to dict
2026-03-06 00:13:13 +01:00
JimmyandGitHub bde2914dec chore: Remove featuredImageField from configuration (#1298)
chore: Remove `featuredImageField` from configuration.
2026-03-05 23:56:27 +01:00
JimmyandGitHub f5adf4a273 fix: do not display the date of term pages (#1296) 2026-03-05 18:25:04 +01:00
JimmyandGitHub 07fa7615eb refactor: simplify article-list/tile partial context passing (#1295)
refactor: simplify `article-list/tile` partial context passing and internal usage.
2026-03-05 18:15:05 +01:00
10 changed files with 39 additions and 57 deletions
+1 -21
View File
@@ -1,6 +1,7 @@
html { html {
font-size: 62.5%; font-size: 62.5%;
overflow-y: scroll; overflow-y: scroll;
scrollbar-gutter: stable;
} }
* { * {
@@ -18,24 +19,3 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
/* scrollbar styles for Firefox */
* {
scrollbar-width: auto;
scrollbar-color: var(--scrollbar-thumb) transparent;
}
/**/
/* scrollbar styles for Chromium */
::-webkit-scrollbar {
height: auto;
}
::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb);
}
::-webkit-scrollbar-track {
background-color: transparent;
}
/**/
-4
View File
@@ -133,10 +133,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
color: var(--card-text-color-main); color: var(--card-text-color-main);
::-webkit-scrollbar-thumb {
background-color: var(--card-separator-color);
}
} }
.widget--toc { .widget--toc {
-5
View File
@@ -19,17 +19,12 @@
--section-separation: 40px; --section-separation: 40px;
--scrollbar-thumb: hsl(0, 0%, 85%);
--scrollbar-track: var(--body-background);
&[data-scheme="dark"] { &[data-scheme="dark"] {
--body-background: #303030; --body-background: #303030;
--accent-color: #ecf0f1; --accent-color: #ecf0f1;
--accent-color-darker: #bdc3c7; --accent-color-darker: #bdc3c7;
--accent-color-text: #000; --accent-color-text: #000;
--body-text-color: rgba(255, 255, 255, 0.7); --body-text-color: rgba(255, 255, 255, 0.7);
--scrollbar-thumb: hsl(0, 0%, 40%);
--scrollbar-track: var(--body-background);
} }
} }
+3 -1
View File
@@ -1,5 +1,4 @@
mainSections = ["post"] mainSections = ["post"]
featuredImageField = "image"
rssFullContent = true rssFullContent = true
# Accepted values: "default", "lastmod" # Accepted values: "default", "lastmod"
# default = see https://gohugo.io/quick-reference/glossary/#default-sort-order # default = see https://gohugo.io/quick-reference/glossary/#default-sort-order
@@ -78,6 +77,9 @@ SortBy = "default"
[imageProcessing] [imageProcessing]
autoOrient = false autoOrient = false
[imageProcessing.external]
timeout = "5s"
[imageProcessing.content] [imageProcessing.content]
widths = [800, 1600, 2400] widths = [800, 1600, 2400]
enabled = true enabled = true
+8 -4
View File
@@ -11,14 +11,18 @@
{{- $description = $description | default (T "list.page" (len .Pages)) -}} {{- $description = $description | default (T "list.page" (len .Pages)) -}}
{{- end -}} {{- end -}}
{{- if or $description (not .Date.IsZero) -}} {{- if or $description (not .Date.IsZero) -}}
{{/*
If it's a term, the date is extracted from the first page of the collection, which is not very useful.
In that case, we prefer to display the description (if set), or the number of pages within the collection.
*/}}
<footer class="article-meta"> <footer class="article-meta">
{{- if not .Date.IsZero -}} {{- if or $IsTerm .Date.IsZero -}}
<span class="article-description">{{- $description -}}</span>
{{- else if not .Date.IsZero -}}
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date | time.Format .Site.Params.dateFormat.published -}} {{- .Date | time.Format .Site.Params.dateFormat.published -}}
</time> </time>
{{- else if $description -}} {{- end }}
<span class="article-description">{{- $description -}}</span>
{{ end }}
</footer> </footer>
{{- end -}} {{- end -}}
</div> </div>
+5 -5
View File
@@ -1,16 +1,16 @@
{{ $image := partial "helper/image" (dict "Image" .context.Params.image "Resources" .context.Resources "Context" .context) }} {{ $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) }}
<article class="{{ if $image }}has-image{{ end }}"> <article class="{{ if $image }}has-image{{ end }}">
<a href="{{ .context.RelPermalink }}"> <a href="{{ .RelPermalink }}">
{{ if $image }} {{ if $image }}
<div class="article-image"> <div class="article-image">
{{ partial "helper/thumbnail-image" (dict {{ partial "helper/thumbnail-image" (dict
"Resource" $image.Resource "Resource" $image.Resource
"Width" 250 "Width" 250
"Height" 150 "Height" 150
"Resize" .context.Site.Params.ImageProcessing.Thumbnail.Enabled "Resize" .Site.Params.ImageProcessing.Thumbnail.Enabled
"Attributes" (dict "Attributes" (dict
"src" $image.Permalink "src" $image.Permalink
"alt" (printf "Featured image of post %s" .context.Title) "alt" (printf "Featured image of post %s" .Title)
"loading" "lazy" "loading" "lazy"
"width" $image.Width "width" $image.Width
"height" $image.Height "height" $image.Height
@@ -30,7 +30,7 @@
{{- end -}} {{- end -}}
> >
<h2 class="article-title"> <h2 class="article-title">
{{- .context.Title -}} {{- .Title -}}
</h2> </h2>
</div> </div>
</a> </a>
@@ -5,7 +5,7 @@
<div class="subsection-list"> <div class="subsection-list">
<div class="article-list--tile"> <div class="article-list--tile">
{{ range . }} {{ range . }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }} {{ partial "article-list/tile" . }}
{{ end }} {{ end }}
</div> </div>
</div> </div>
+12 -7
View File
@@ -9,28 +9,32 @@
/// Height: Image height /// Height: Image height
/// Width: Image width /// Width: Image width
{{ $result := "" }} {{ $result := dict }}
{{ if .Image }} {{ if .Image }}
{{ $url := urls.Parse .Image }} {{ $url := urls.Parse .Image }}
{{ $permalink := .Image }} {{ $permalink := .Image }}
{{ $resource := "" }} {{ $resource := dict
"Resource" nil
"Permalink" $permalink
"Height" nil
"Width" nil
}}
{{ $local := true }} {{ $local := true }}
{{ if not (in (slice "https" "http") $url.Scheme) }} {{ if not (in (slice "https" "http") $url.Scheme) }}
{{/* Local image */}} {{/* Local image */}}
{{ $resource = .Resources.Get (printf "%s" (.Image | safeURL)) }} {{ $resource = .Resources.Get (printf "%s" (.Image | safeURL)) }}
{{ $permalink = $resource.RelPermalink }}
{{ else }} {{ else }}
{{/* Remote image */}} {{/* Remote image */}}
{{ with try (resources.GetRemote $url) }} {{ with try (resources.GetRemote $url (dict "timeout" .Context.Site.Params.imageProcessing.external.timeout)) }}
{{ with .Err }} {{ with .Err }}
{{ errorf "%s" . }} {{ warnf "Failed to fetch remote resource %q: %s" $url . }}
{{ else with .Value }} {{ else with .Value }}
{{ $resource = . }} {{ $resource = . }}
{{ $local = false }} {{ $local = false }}
{{ else }} {{ else }}
{{ errorf "Unable to get remote resource %q" $url }} {{ warnf "Unable to get remote resource %q" $url }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
@@ -39,10 +43,11 @@
{{ if and .Context.Site.Params.imageProcessing.autoOrient (reflect.IsImageResourceProcessable $resource) }} {{ if and .Context.Site.Params.imageProcessing.autoOrient (reflect.IsImageResourceProcessable $resource) }}
{{ $filter := images.AutoOrient }} {{ $filter := images.AutoOrient }}
{{ $resource = $resource | images.Filter $filter }} {{ $resource = $resource | images.Filter $filter }}
{{ end }}
{{ if $local }} {{ if $local }}
{{ $permalink = $resource.RelPermalink }} {{ $permalink = $resource.RelPermalink }}
{{ end }} {{ end }}
{{ end }}
{{ if reflect.IsImageResourceWithMeta $resource }} {{ if reflect.IsImageResourceWithMeta $resource }}
{{ $result = dict {{ $result = dict
+1 -1
View File
@@ -8,7 +8,7 @@
<div class="subsection-list"> <div class="subsection-list">
<div class="article-list--tile"> <div class="article-list--tile">
{{ range $terms }} {{ range $terms }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }} {{ partial "article-list/tile" . }}
{{ end }} {{ end }}
</div> </div>
</div> </div>
+1 -1
View File
@@ -51,7 +51,7 @@
<div class="subsection-list"> <div class="subsection-list">
<div class="article-list--tile"> <div class="article-list--tile">
{{ range . }} {{ range . }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }} {{ partial "article-list/tile" . }}
{{ end }} {{ end }}
</div> </div>
</div> </div>