Skip to content

Default theme: show the features plugin's grid on the home page - #698

Merged
compscidr merged 2 commits into
mainfrom
compscidr/add-a-features-plugin
Oct 21, 2026
Merged

compscidr merged 2 commits into
mainfrom
compscidr/add-a-features-plugin

Conversation

@compscidr

Copy link
Copy Markdown
Collaborator

Part of #650.

The features plugin itself is a separate WebAssembly plugin repo (goblog-plugin-features, pending creation): a /features page 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.html so 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: main currently doesn't build (stale goblog/... imports) — CI here will fail until #696 merges. Tested on top of #696: go test . ./theme/... ./blog/... pass.

🤖 Generated with Claude Code

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>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 09:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@compscidr
compscidr merged commit 83b7620 into main Oct 21, 2026
5 checks passed
@compscidr
compscidr deleted the compscidr/add-a-features-plugin branch October 21, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants