From f9191a18bcb0c40578724149f845ad96511ce462 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 14 Aug 2026 08:43:16 -0500 Subject: [PATCH] fix: make topics reachable and stop the head fighting itself Every topic archive rendered its character art gate against the design master, which package-theme.sh deliberately strips, so production showed an empty stage on all eight of them. Gate on the derivative the markup actually loads instead. Nothing linked to a topic archive: the only filter was a select inside a form, invisible to crawlers and to anyone not looking for it. The stream now also lists the non-empty topics as links, marking the current one. Empty topics stay out, because a dead archive is worse than no link. Rank Math already owns the document head, so the theme's own og: tags were a second, conflicting set and core's title tag was a literal duplicate. Both now yield when an SEO plugin is active. Category archives listed the same posts as their topic at a second indexable URL. They now redirect to the same-slug topic, or the Journal. Co-Authored-By: Claude Opus 5 (1M context) --- assets/css/components.css | 30 +++++++++++++++++++++++ blocks/featured-stories/block.json | 2 +- blocks/footer-content/block.json | 2 +- blocks/header-tools/block.json | 2 +- blocks/journal-link/block.json | 2 +- blocks/journal-stream/block.json | 2 +- blocks/journal-stream/render.php | 31 ++++++++++++++++++++++++ blocks/journal-stream/style.css | 9 +++++++ blocks/latest-podcast/block.json | 2 +- blocks/mobile-menu-toggle/block.json | 2 +- blocks/podcast-meta/block.json | 2 +- blocks/reading-time/block.json | 2 +- blocks/related-posts/block.json | 2 +- blocks/release-detail/block.json | 2 +- blocks/release-list/block.json | 2 +- blocks/selected-work/block.json | 2 +- blocks/show-links/block.json | 2 +- blocks/site-brand/block.json | 2 +- blocks/subscribe-cta/block.json | 2 +- blocks/subscribe-form/block.json | 2 +- blocks/theme-toggle/block.json | 2 +- blocks/topic-hero/block.json | 2 +- blocks/topic-hero/render.php | 9 ++++++- blocks/track-meta/block.json | 2 +- functions.php | 2 +- inc/setup.php | 31 ++++++++++++++++++++++-- inc/taxonomies.php | 36 ++++++++++++++++++++++++++++ style.css | 2 +- 28 files changed, 165 insertions(+), 25 deletions(-) diff --git a/assets/css/components.css b/assets/css/components.css index e6379c7..0a797d0 100644 --- a/assets/css/components.css +++ b/assets/css/components.css @@ -423,6 +423,36 @@ footer a { --chrnx-card-accent: #d36b3f; } +.chrnx-journal-stream__topics { + margin-block-start: 1.5rem; +} + +.chrnx-journal-stream__topic { + display: inline-block; + padding: 0.4rem 0.9rem; + border: 1px solid var(--chrnx-line); + border-radius: 999px; + color: var(--chrnx-muted); + font-family: var(--wp--preset--font-family--metadata); + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.12em; + text-decoration: none; + text-transform: uppercase; +} + +.chrnx-journal-stream__topic:hover, +.chrnx-journal-stream__topic:focus-visible { + border-color: var(--chrnx-green); + color: var(--chrnx-green); +} + +.chrnx-journal-stream__topic[aria-current="page"] { + border-color: var(--chrnx-green); + background: var(--chrnx-green); + color: var(--chrnx-bg); +} + .chrnx-journal-stream__filters { align-items: end; margin-block: 2rem; diff --git a/blocks/featured-stories/block.json b/blocks/featured-stories/block.json index 714e0cd..62fe717 100644 --- a/blocks/featured-stories/block.json +++ b/blocks/featured-stories/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/featured-stories", - "version": "0.3.0", + "version": "0.4.0", "title": "Featured Stories", "category": "theme", "description": "A sticky-led selection of topic-diverse stories.", diff --git a/blocks/footer-content/block.json b/blocks/footer-content/block.json index e7e20e3..e6bd323 100644 --- a/blocks/footer-content/block.json +++ b/blocks/footer-content/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/footer-content", - "version": "0.3.0", + "version": "0.4.0", "title": "CHRNX Footer Content", "category": "theme", "description": "Display translated internal footer navigation and site credit.", diff --git a/blocks/header-tools/block.json b/blocks/header-tools/block.json index b5019f4..3f54be4 100644 --- a/blocks/header-tools/block.json +++ b/blocks/header-tools/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/header-tools", - "version": "0.3.0", + "version": "0.4.0", "title": "CHRNX Header Tools", "category": "theme", "description": "Display translated primary navigation and progressive site search.", diff --git a/blocks/journal-link/block.json b/blocks/journal-link/block.json index 9393478..0c6603a 100644 --- a/blocks/journal-link/block.json +++ b/blocks/journal-link/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/journal-link", - "version": "0.3.0", + "version": "0.4.0", "title": "Journal Link", "category": "theme", "description": "Display a translated portable link to the full Journal.", diff --git a/blocks/journal-stream/block.json b/blocks/journal-stream/block.json index 8d894f5..eae6641 100644 --- a/blocks/journal-stream/block.json +++ b/blocks/journal-stream/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/journal-stream", - "version": "0.3.0", + "version": "0.4.0", "title": "Journal Stream", "category": "theme", "description": "The filterable chronological journal.", diff --git a/blocks/journal-stream/render.php b/blocks/journal-stream/render.php index 68ae684..041332a 100644 --- a/blocks/journal-stream/render.php +++ b/blocks/journal-stream/render.php @@ -29,6 +29,37 @@ $chrnx_title = null !== $chrnx_pinned_term ? $chrnx_pinned_term->name : __( 'Jou ?>
'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby=""> id="">> + 'chrnx_topic', + 'hide_empty' => true, + ) + ); + $chrnx_topic_terms = is_wp_error( $chrnx_topic_terms ) ? array() : $chrnx_topic_terms; + ?> + 1 ) : ?> + +

diff --git a/blocks/journal-stream/style.css b/blocks/journal-stream/style.css index 4f2fbfb..01b532f 100644 --- a/blocks/journal-stream/style.css +++ b/blocks/journal-stream/style.css @@ -1,3 +1,12 @@ +.chrnx-journal-stream__topics ul { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + list-style: none; + padding: 0; + margin: 0; +} + .chrnx-journal-stream__filters { display: flex; flex-wrap: wrap; diff --git a/blocks/latest-podcast/block.json b/blocks/latest-podcast/block.json index e5085ed..75f61c8 100644 --- a/blocks/latest-podcast/block.json +++ b/blocks/latest-podcast/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/latest-podcast", - "version": "0.3.0", + "version": "0.4.0", "title": "Latest Podcast", "category": "theme", "description": "A linked card for the latest podcast episode.", diff --git a/blocks/mobile-menu-toggle/block.json b/blocks/mobile-menu-toggle/block.json index 87058c1..9349ae7 100644 --- a/blocks/mobile-menu-toggle/block.json +++ b/blocks/mobile-menu-toggle/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/mobile-menu-toggle", - "version": "0.3.0", + "version": "0.4.0", "title": "CHRNX Mobile Menu Toggle", "category": "theme", "description": "Progressively reveal the primary navigation on small screens.", diff --git a/blocks/podcast-meta/block.json b/blocks/podcast-meta/block.json index f82fce2..74f444d 100644 --- a/blocks/podcast-meta/block.json +++ b/blocks/podcast-meta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/podcast-meta", - "version": "0.3.0", + "version": "0.4.0", "title": "Podcast Metadata", "category": "theme", "description": "Safe episode details for the current post.", diff --git a/blocks/reading-time/block.json b/blocks/reading-time/block.json index e3b38b2..33f9f1f 100644 --- a/blocks/reading-time/block.json +++ b/blocks/reading-time/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/reading-time", - "version": "0.3.0", + "version": "0.4.0", "title": "Reading Time", "category": "theme", "description": "Display a localized estimate based on the current post content.", diff --git a/blocks/related-posts/block.json b/blocks/related-posts/block.json index 4bb9bdc..7f9491f 100644 --- a/blocks/related-posts/block.json +++ b/blocks/related-posts/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/related-posts", - "version": "0.3.0", + "version": "0.4.0", "title": "Related Posts", "category": "theme", "description": "Related stories selected by topic, tags, and recency.", diff --git a/blocks/release-detail/block.json b/blocks/release-detail/block.json index c84583b..ea16146 100644 --- a/blocks/release-detail/block.json +++ b/blocks/release-detail/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/release-detail", - "version": "0.3.0", + "version": "0.4.0", "title": "Release Detail", "category": "theme", "description": "Album cover, listening links, and the ordered tracklist.", diff --git a/blocks/release-list/block.json b/blocks/release-list/block.json index b193cad..dbc17b8 100644 --- a/blocks/release-list/block.json +++ b/blocks/release-list/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/release-list", - "version": "0.3.0", + "version": "0.4.0", "title": "Release List", "category": "theme", "description": "The No Names releases, each linking to its album page.", diff --git a/blocks/selected-work/block.json b/blocks/selected-work/block.json index 0871ed2..88ed9c5 100644 --- a/blocks/selected-work/block.json +++ b/blocks/selected-work/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/selected-work", - "version": "0.3.0", + "version": "0.4.0", "title": "Selected Work", "category": "theme", "description": "Hand-picked projects first, then the most recent ones.", diff --git a/blocks/show-links/block.json b/blocks/show-links/block.json index 2ae185a..e1585b7 100644 --- a/blocks/show-links/block.json +++ b/blocks/show-links/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/show-links", - "version": "0.3.0", + "version": "0.4.0", "title": "Show Links", "category": "theme", "description": "Where a podcast show can be listened to, rendered only when a URL exists.", diff --git a/blocks/site-brand/block.json b/blocks/site-brand/block.json index bd176b8..1d39e77 100644 --- a/blocks/site-brand/block.json +++ b/blocks/site-brand/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/site-brand", - "version": "0.3.0", + "version": "0.4.0", "title": "CHRNX Site Brand", "category": "theme", "description": "Display the local CHRNX wordmark linked to the site home.", diff --git a/blocks/subscribe-cta/block.json b/blocks/subscribe-cta/block.json index 1f15f8f..c481f76 100644 --- a/blocks/subscribe-cta/block.json +++ b/blocks/subscribe-cta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/subscribe-cta", - "version": "0.3.0", + "version": "0.4.0", "title": "Subscribe CTA", "category": "theme", "description": "A call to action linked to the configured subscribe page.", diff --git a/blocks/subscribe-form/block.json b/blocks/subscribe-form/block.json index 6c63366..ed1dc82 100644 --- a/blocks/subscribe-form/block.json +++ b/blocks/subscribe-form/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/subscribe-form", - "version": "0.3.0", + "version": "0.4.0", "title": "Subscribe Form", "category": "theme", "description": "The email subscription form, rendered only when a provider endpoint is configured.", diff --git a/blocks/theme-toggle/block.json b/blocks/theme-toggle/block.json index 6484637..4d023c4 100644 --- a/blocks/theme-toggle/block.json +++ b/blocks/theme-toggle/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/theme-toggle", - "version": "0.3.0", + "version": "0.4.0", "title": "Theme Toggle", "category": "theme", "description": "Choose a light, dark, or system color theme.", diff --git a/blocks/topic-hero/block.json b/blocks/topic-hero/block.json index 0a4cc00..0c6d4b3 100644 --- a/blocks/topic-hero/block.json +++ b/blocks/topic-hero/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/topic-hero", - "version": "0.3.0", + "version": "0.4.0", "title": "Topic Hero", "category": "theme", "description": "A fixed-art hero for an editorial topic.", diff --git a/blocks/topic-hero/render.php b/blocks/topic-hero/render.php index c152bb1..a7d49a7 100644 --- a/blocks/topic-hero/render.php +++ b/blocks/topic-hero/render.php @@ -22,7 +22,14 @@ $chrnx_art_topic = 'chrnx_show' === $chrnx_taxonomy ? 'podcasts' : $chrnx_topic; $chrnx_asset = chrnx_get_topic_art_asset( $chrnx_art_topic ); $chrnx_size = chrnx_get_topic_art_dimensions( $chrnx_art_topic ); $chrnx_has_art = '' !== $chrnx_asset && 2 === count( $chrnx_size ); -$chrnx_has_image = $chrnx_has_art && is_readable( get_theme_file_path( $chrnx_asset ) ); +/* + * The packaged theme ships only assets/images/generated, so the design master + * is absent in production and gating on it hid the art on every topic archive. + * Check the derivative the markup actually loads. + */ +$chrnx_has_image = $chrnx_has_art && is_readable( + get_theme_file_path( 'assets/images/generated/' . pathinfo( $chrnx_asset, PATHINFO_FILENAME ) . '-768.webp' ) +); $chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 ); $chrnx_term = $chrnx_queried instanceof WP_Term && $chrnx_queried->slug === $chrnx_topic ? $chrnx_queried : get_term_by( 'slug', $chrnx_topic, 'chrnx_topic' ); $chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucwords( str_replace( '-', ' ', $chrnx_topic ) ); diff --git a/blocks/track-meta/block.json b/blocks/track-meta/block.json index 4da7349..ac5f378 100644 --- a/blocks/track-meta/block.json +++ b/blocks/track-meta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/track-meta", - "version": "0.3.0", + "version": "0.4.0", "title": "Track Meta", "category": "theme", "description": "Player, listening links, and album for one song.", diff --git a/functions.php b/functions.php index 69c1339..5e26443 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,5 @@ ' . "\n"; } add_action( 'wp_head', 'chrnx_print_social_meta' ); + +/** + * Report whether an SEO plugin owns the document head. + * + * @return bool True when a known SEO plugin is active. + */ +function chrnx_has_seo_plugin(): bool { + return defined( 'RANK_MATH_VERSION' ) || defined( 'WPSEO_VERSION' ) || defined( 'SEOPRESS_VERSION' ); +} + +/** + * Drop core's title tag when an SEO plugin prints its own. + * + * Both were rendering, so every page shipped two elements. + */ +function chrnx_remove_duplicate_title_tag() { + if ( chrnx_has_seo_plugin() ) { + remove_action( 'wp_head', '_wp_render_title_tag', 1 ); + } +} +add_action( 'wp_head', 'chrnx_remove_duplicate_title_tag', 0 ); diff --git a/inc/taxonomies.php b/inc/taxonomies.php index 079c320..1c4ec51 100644 --- a/inc/taxonomies.php +++ b/inc/taxonomies.php @@ -123,6 +123,42 @@ function chrnx_seed_editorial_terms() { } add_action( 'after_switch_theme', 'chrnx_seed_editorial_terms' ); +/** + * Retire the legacy category archives. + * + * chrnx_topic is the editorial taxonomy. Category archives listed the same + * posts at a second indexable URL, so both competed for the same queries. + * A same-slug topic keeps that equity; everything else folds into the Journal. + * + * ponytail: matching by slug instead of a hand-kept category-to-topic map. + */ +function chrnx_redirect_legacy_category_archives() { + if ( ! is_category() ) { + return; + } + + $category = get_queried_object(); + $target = ''; + if ( $category instanceof WP_Term ) { + $topic = get_term_by( 'slug', $category->slug, 'chrnx_topic' ); + if ( $topic instanceof WP_Term && $topic->count > 0 ) { + $link = get_term_link( $topic ); + $target = is_wp_error( $link ) ? '' : $link; + } + } + + if ( '' === $target ) { + $target = chrnx_get_full_journal_url(); + } + if ( '' === $target ) { + return; + } + + wp_safe_redirect( $target, 301 ); + exit; +} +add_action( 'template_redirect', 'chrnx_redirect_legacy_category_archives' ); + /** * Return the current user's editorial notice transient key. * diff --git a/style.css b/style.css index 82ca28b..c99658e 100644 --- a/style.css +++ b/style.css @@ -3,6 +3,6 @@ Theme Name: CHRNX Description: A native block theme for chrnx.dev. Requires at least: 6.9 Requires PHP: 8.1 -Version: 0.3.0 +Version: 0.4.0 Text Domain: chrnx */