fix: broken links, add check to CI

This commit is contained in:
2026-04-01 11:31:35 +02:00
parent 9bb7fcc300
commit 3a5b758b10
3 changed files with 10 additions and 8 deletions

View File

@@ -49,8 +49,12 @@ jobs:
- name: Build website with Hugo
run: hugo
- name: Check for broken links
run: mise linkcheck --offline
continue-on-error: ${{ gitea.ref == 'refs/heads/main' }}
- name: Copy website to host
uses: https://github.com/appleboy/scp-action@v1.0.0
uses: https://github.com/appleboy/scp-action@ff85246acaad7bdce478db94a363cd2bf7c90345 # v1.0.0
with:
host: mehl.mx
username: maxmehl

View File

@@ -14,18 +14,13 @@ depends = ["cleanup"]
description = "Build the static site using Hugo"
run = "hugo -d {{vars.build_dir}}"
[tasks.build-root]
depends = ["cleanup"]
description = "Build the static site using Hugo, not using subdirectory as baseURL"
run = "hugo --baseURL / -d {{vars.build_dir}}"
[tasks.preview]
depends = ["cleanup"]
description = "Preview the site locally using Hugo's built-in server"
run = "hugo server"
[tasks.linkcheck]
depends = ["build-root"]
depends = ["build"]
description = "Check for broken links using lychee"
run = '''
lychee \
@@ -33,5 +28,6 @@ lychee \
--index-files 'index.html' \
--root-dir {{vars.build_dir}}/ \
-u 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Apple WebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--exclude 'glyphicons-halflings-regular\.(eot|woff|woff2|ttf|svg)' \
{{vars.build_dir}}/
'''

View File

@@ -65,7 +65,9 @@
</div>
<div class="col-xs-9 col-md-10">
{{ if $selection }}
<span class="article-rss"><a class="label label-rss" href="/{{ .Data.Plural }}/{{lower .Title}}/index.xml" title="RSS Feed"><i class="fa fa-rss" aria-hidden="true"></i> Subscribe to »{{.Title}}«</a></span>
{{- with .OutputFormats.Get "RSS" -}}
<span class="article-rss"><a class="label label-rss" href="{{ .Permalink }}" title="RSS Feed"><i class="fa fa-rss" aria-hidden="true"></i> Subscribe to »{{ $.Title }}«</a></span>
{{- end -}}
{{ else }}
<span class="article-rss"><a class="label label-rss" href="/blog/index.xml" title="RSS Feed"><i class="fa fa-rss" aria-hidden="true"></i> Subscribe to all posts</a></span>
{{ end }}