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
@@ -29,6 +29,37 @@ $chrnx_title = null !== $chrnx_pinned_term ? $chrnx_pinned_term->name : __( 'Jou
|
||||
?>
|
||||
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>">
|
||||
<h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html( $chrnx_title ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||
<?php
|
||||
/*
|
||||
* The select below is invisible to crawlers and to anyone not hunting for it.
|
||||
* These are the same filters as real links, so topics have an entry point.
|
||||
* Empty topics stay hidden: a dead archive is worse than no link.
|
||||
*/
|
||||
$chrnx_topic_terms = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_topic',
|
||||
'hide_empty' => true,
|
||||
)
|
||||
);
|
||||
$chrnx_topic_terms = is_wp_error( $chrnx_topic_terms ) ? array() : $chrnx_topic_terms;
|
||||
?>
|
||||
<?php if ( count( $chrnx_topic_terms ) > 1 ) : ?>
|
||||
<nav class="chrnx-journal-stream__topics" aria-label="<?php echo esc_attr__( 'Topics', 'chrnx' ); ?>">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="chrnx-journal-stream__topic" href="<?php echo esc_url( chrnx_get_full_journal_url() ); ?>"<?php echo '' === $chrnx_topic ? ' aria-current="page"' : ''; ?>><?php echo esc_html__( 'All', 'chrnx' ); ?></a>
|
||||
</li>
|
||||
<?php foreach ( $chrnx_topic_terms as $chrnx_term ) : ?>
|
||||
<?php $chrnx_term_link = get_term_link( $chrnx_term ); ?>
|
||||
<?php if ( ! is_wp_error( $chrnx_term_link ) ) : ?>
|
||||
<li>
|
||||
<a class="chrnx-journal-stream__topic" href="<?php echo esc_url( $chrnx_term_link ); ?>"<?php echo $chrnx_topic === $chrnx_term->slug ? ' aria-current="page"' : ''; ?>><?php echo esc_html( $chrnx_term->name ); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>">
|
||||
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?>
|
||||
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
|
||||
|
||||
Reference in new issue
Block a user