You've already forked wp-bootstrap
fix: make page title <h1> conditional to prevent double headings (v1.0.3)
When plugins inject content via TwigService with empty post.title, the theme's <h1> is now skipped. Prevents duplicate headings on plugin-rendered pages that provide their own titles. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
15
CLAUDE.md
15
CLAUDE.md
@@ -193,6 +193,21 @@ Build steps (in order):
|
||||
|
||||
## Session History
|
||||
|
||||
### Session 11 — v1.0.3 Conditional Page Title (2026-02-11)
|
||||
|
||||
**Completed:** Made `<h1>` on page template conditional to prevent double headings when plugins provide their own titles.
|
||||
|
||||
**What was fixed:**
|
||||
|
||||
- `views/pages/page.html.twig` now wraps `<h1>{{ post.title }}</h1>` in `{% if post.title is not empty %}` guard
|
||||
- When a plugin passes empty `post.title` via `render_via_theme_twig()`, the theme's `<h1>` is skipped
|
||||
- Prevents duplicate headings on pages where plugin templates render their own `<h1>` with richer context (icons, badges, meta)
|
||||
|
||||
**Key learnings:**
|
||||
|
||||
- Plugins that delegate rendering to the parent theme via `TwigService` should be able to opt out of the theme's `<h1>` by passing empty `post.title`
|
||||
- The `is not empty` Twig test correctly handles both `null` and empty string `''`
|
||||
|
||||
### Session 10 — v1.0.2 Title Tag Fix (2026-02-10)
|
||||
|
||||
**Completed:** Fixed missing HTML `<title>` tag on all pages rendered by the theme's Twig pipeline.
|
||||
|
||||
Reference in New Issue
Block a user