Extract shared head template from themes#526
Merged
Conversation
Move all <head> content (meta tags, OG, structured data, CDN imports) into a shared _head.html template loaded alongside any theme. Themes now only control <body> layout and navigation. Adds site_url and robots_tag settings so OG URLs and indexing are configurable per instance rather than hardcoded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR centralizes duplicated <head> markup across themes into a shared template and adds configurable settings to support per-instance SEO metadata.
Changes:
- Added
templates/shared/_head.htmland updated themes to call{{ template "_head" . }}. - Added new settings
robots_tagandsite_urlto default settings seeding. - Updated template loading (and tests) to parse shared templates before theme templates.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/migrate.go | Seeds new robots_tag/site_url settings. |
| themes/minimal/templates/header.html | Replaces inline <head> with shared _head template call. |
| themes/forest/templates/header.html | Replaces inline <head> with shared _head template call. |
| themes/default/templates/header.html | Replaces inline <head> with shared _head template call. |
| templates/shared/_head.html | New shared head template containing meta/OG/JSON-LD/CDN imports. |
| goblog.go | Loads shared templates first, then theme templates; updates fallback behavior. |
| blog/blog_test.go | Updates test template loading to include shared templates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<head>content (meta tags, OG, structured data, CDN imports) into a sharedtemplates/shared/_head.htmltemplate{{ template "_head" . }}then define their own<body>and navigationsite_urlsetting so OG/structured data URLs are configurable per instance (replaces hardcodedhttps://www.jasonernst.com)robots_tagsetting (default:index, follow) so staging instances can setnoindex, nofollowTest plan
robots_tagtonoindex, nofollowon staging and verify meta tag appearssite_urland verify OG tags use it🤖 Generated with Claude Code