Skip to content

Commit 6377c32

Browse files
oschwaldclaude
andcommitted
Guard .File.BaseFileName in title for virtual pages
`.File` is nil on virtual pages (e.g., taxonomy listings before they were disabled). Wrap with `with .File` so the title rendering is null-safe even if future virtual pages get enabled. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d901463 commit 6377c32

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/layouts/_default/default.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ or .Title .File.BaseFileName }} | {{ .Site.Title }}{{ end }}</title>
6+
{{- $title := .Title -}}
7+
{{- if not $title }}{{ with .File }}{{ $title = .BaseFileName }}{{ end }}{{- end -}}
8+
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with $title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
79
<style>
810
:root {
911
--fg: #2d2d2d;

0 commit comments

Comments
 (0)