Skip to content

Commit 90594a6

Browse files
compscidrclaude
andcommitted
Address review feedback on shared head template
- Fail fast (log.Fatalf) when shared templates fail to load, since all themes depend on _head being available - Seed site_url with https://www.example.com instead of empty string, so OG/structured data URLs are always absolute - Fall back to "index, follow" when robots_tag value is empty, not just when the setting key is missing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 834bab3 commit 90594a6

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

goblog.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,7 @@ func main() {
377377
// Load shared templates first, then theme templates
378378
tmpl, err := template.New("").Funcs(funcMap).ParseGlob("templates/shared/*.html")
379379
if err != nil {
380-
log.Printf("Warning: failed to load shared templates: %v", err)
381-
tmpl = template.New("").Funcs(funcMap)
380+
log.Fatalf("Failed to load shared templates: %v", err)
382381
}
383382
tmpl, err = tmpl.ParseGlob(themePath + "templates/*.html")
384383
if err != nil {

templates/shared/_head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="keywords" content="{{ .settings.site_title.Value }}{{range .post.Tags}}, {{.Name}}{{end}}">
77
<meta name="author" content="{{ .settings.site_title.Value }}">
88
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9-
<meta name="robots" content="{{ with index .settings "robots_tag" }}{{ .Value }}{{ else }}index, follow{{ end }}" />
9+
<meta name="robots" content="{{ with index .settings "robots_tag" }}{{ if .Value }}{{ .Value }}{{ else }}index, follow{{ end }}{{ else }}index, follow{{ end }}" />
1010
<meta property="og:site_name" content="{{ .settings.site_title.Value }}">
1111
{{ if .post }}
1212
<meta name="description" content="{{ .post.PlainTextPreview 155 }}">

tools/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func seedDefaultSettings(db *gorm.DB) {
277277
{Key: "custom_footer_code", Type: "textarea", Value: ""},
278278
{Key: "theme", Type: "text", Value: "default"},
279279
{Key: "robots_tag", Type: "text", Value: "index, follow"},
280-
{Key: "site_url", Type: "text", Value: ""},
280+
{Key: "site_url", Type: "text", Value: "https://www.example.com"},
281281
}
282282
for _, s := range defaults {
283283
db.Where("key = ?", s.Key).FirstOrCreate(&s)

0 commit comments

Comments
 (0)