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) <noreply@anthropic.com>
This commit is contained in:
28 files changed
+165
-25
No files matched your search
@@ -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.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user