Repository navigation
Default theme: show the features plugin's grid on the home page - #698
Conversation
Renders .plugins.features.html under the hero when the features plugin (goblog-plugin-features, #650) is installed, enabled and has cards. Nil-safe when the plugin is absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The single-line template addition is nil-safe, follows the existing with ... rawHTML plugin-rendering convention, and renders nothing when the plugin is absent.
No open issues 🎉
What changed in this PR
This PR adds a single line to the default theme's home.html so that, when the (separate, not-yet-created) features WebAssembly plugin is installed, enabled, and has cards, its grid renders beneath the hero on the landing page. It is part of #650 ("add a features plugin").
The change relies on the existing plugin→template data pipeline: Blog.Render calls Registry.InjectTemplateData, which sets data["plugins"] to a gin.H keyed by each plugin's name (plugin/registry.go:453-460). The {{ with .plugins.features }} guard makes it a no-op when the plugin is absent, and {{ .html | rawHTML }} emits the plugin-provided grid HTML via the canonical rawHTML func (theme/load.go:28). This mirrors the existing {{ with .plugin_head_html }}{{ . | rawHTML }}{{ end }} pattern in templates/shared/_head.html:150 and the .plugins.socialicons access in the same file, so it is consistent with codebase conventions.
Changes:
- Render the features plugin's grid on the home page under the hero section.
| File | Description |
|---|---|
themes/default/templates/home.html |
Adds a with-guarded line that renders .plugins.features.html via rawHTML, showing the plugin grid when present and nothing otherwise. |
I confirmed the change is nil-safe in practice: data["plugins"] is always populated for the home render path (home uses b.Render → InjectTemplateData), an absent features key makes {{ with }} fall through, and the default missingKey behavior keeps even a missing .plugins key from erroring. The access and rawHTML usage match established patterns, and themes/default is the only theme shipping home.html, so the change is complete and correctly scoped. I found no issues worth a PR comment.
Review effort: Balanced
Part of #650.
The features plugin itself is a separate WebAssembly plugin repo (
goblog-plugin-features, pending creation): a/featurespage with feature cards (icon | title | description | link, one per line) that also exposes the grid to themes as.plugins.features.html/.plugins.features.items.This PR adds one line to the default theme's
home.htmlso the grid shows under the hero on the landing page when the plugin is installed, enabled and has cards. It renders nothing when the plugin is absent (verified nil-safe for missing.plugins/.plugins.features).Note:
maincurrently doesn't build (stalegoblog/...imports) — CI here will fail until #696 merges. Tested on top of #696:go test . ./theme/... ./blog/...pass.🤖 Generated with Claude Code