Skip to content

Commit 1a8d901

Browse files
johanrinclaude
andcommitted
Fix Person schema avatar, pin Actions to SHAs, clean up config
Person schema on the homepage pointed to /avatar.jpg at site root, but the avatar lives in assets/ and was never published — search engines hit a 404. Use resources.Get + .Permalink so Hugo publishes the file and emits the real URL. Pin all GitHub Actions to commit SHAs (with version comment) so a compromised action maintainer can't push into the build pipeline. Auto-generate post titles in the archetype from the bundle directory name, and drop the dead commented [module] block in hugo.toml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 104ebf9 commit 1a8d901

4 files changed

Lines changed: 12 additions & 23 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ jobs:
2525
TZ: Europe/Oslo
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v5
28+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
2929
with:
3030
submodules: recursive
3131
fetch-depth: 0
3232
- name: Setup Go
33-
uses: actions/setup-go@v5
33+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
3434
with:
3535
go-version: ${{ env.GO_VERSION }}
3636
cache: false
3737
- name: Setup Node.js
38-
uses: actions/setup-node@v4
38+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
3939
with:
4040
node-version: ${{ env.NODE_VERSION }}
4141
- name: Setup Pages
4242
id: pages
43-
uses: actions/configure-pages@v5
43+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
4444
- name: Create directory for user-specific executable files
4545
run: |
4646
mkdir -p "${HOME}/.local"
@@ -71,7 +71,7 @@ jobs:
7171
git config core.quotepath false
7272
- name: Cache restore
7373
id: cache-restore
74-
uses: actions/cache/restore@v4
74+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
7575
with:
7676
path: ${{ runner.temp }}/hugo_cache
7777
key: hugo-${{ github.run_id }}
@@ -85,12 +85,12 @@ jobs:
8585
--cacheDir "${{ runner.temp }}/hugo_cache"
8686
- name: Cache save
8787
id: cache-save
88-
uses: actions/cache/save@v4
88+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
8989
with:
9090
path: ${{ runner.temp }}/hugo_cache
9191
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
9292
- name: Upload artifact
93-
uses: actions/upload-pages-artifact@v3
93+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
9494
with:
9595
path: ./public
9696
deploy:
@@ -102,4 +102,4 @@ jobs:
102102
steps:
103103
- name: Deploy to GitHub Pages
104104
id: deployment
105-
uses: actions/deploy-pages@v4
105+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

archetypes/default.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title:
2+
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
33
date: {{ .Date }}
44
draft: true
55
description:

hugo.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,8 @@ enableEmoji = true
1010
# Use git commit dates for .Lastmod (improves sitemap and structured data)
1111
enableGitInfo = true
1212

13-
# traditional way: theme component resides in directory 'themes'
1413
theme = "hugo-blog-awesome"
1514

16-
# modern way: pull in theme component as hugo module
17-
#[module]
18-
# Uncomment the next line to build and serve using local theme clone declared in the named Hugo workspace:
19-
# workspace = "hugo-blog-awesome.work"
20-
#[module.hugoVersion]
21-
#extended = true
22-
#min = "0.87.0"
23-
#[[module.imports]]
24-
#path = "github.com/hugo-sid/hugo-blog-awesome"
25-
#disable = false
26-
2715
[services]
2816
# To enable Google Analytics 4 (gtag.js) provide G-MEASUREMENT_ID below.
2917
# To disable Google Analytics, simply leave the field empty or remove the next two lines

layouts/partials/custom-head.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828

2929
{{/* Person schema for homepage - helps search engines understand the author */}}
3030
{{ if .IsHome }}
31+
{{ $avatar := resources.Get .Site.Params.author.avatar }}
3132
<script type="application/ld+json">
3233
{
3334
"@context": "https://schema.org",
3435
"@type": "Person",
3536
"name": "{{ .Site.Params.author.name }}",
36-
"url": "{{ .Site.BaseURL }}",
37-
"image": "{{ .Site.BaseURL }}avatar.jpg",
37+
"url": "{{ .Site.BaseURL }}",{{ with $avatar }}
38+
"image": "{{ .Permalink }}",{{ end }}
3839
"description": "{{ .Site.Params.author.description }}",
3940
"sameAs": [
4041
{{- $first := true -}}

0 commit comments

Comments
 (0)