From 036242f84a1be883f25127c2b45a0cc96a4d960b Mon Sep 17 00:00:00 2001 From: ssavutu Date: Sat, 8 Aug 2026 01:39:08 -0400 Subject: [PATCH] Send the WordPress category archives that live under /author somewhere WordPress gave categories an author-shaped archive, so /author/crossword, /author/movies and /author/womens-basketball are indexed and still linked. This site serves all of that content, just at /, and the author route answered 404 for every one of them. 31 of the 68 distinct slugs that 404'd on this route name a section or a subsection: 25 subsections (crossword, movies, sudoku, puzzles, satire, the-drawing-board, womens-basketball and the rest) and 6 sections (news, opinion, sports, columns, entertainment, graduation). Those now redirect to the page that holds their content. The check runs only after the author lookup misses, so a real author's page costs nothing extra, and it reads the cached taxonomy rather than the CMS. Only a definite answer redirects: getSlugKind reports 'unavailable' when the taxonomy could not be read, and sending a real author's page to / during a blip would turn a brief outage into a confidently wrong 301 that caches. The remaining 37 slugs are a separate problem and are left alone here. Some are WordPress categories the CMS has no row for at all; the rest are real people whose slugs the import got wrong -- four carry a "by-" prefix taken from the WordPress login, and four more are WordPress's -2 duplicate-account suffix. That is an ETL defect, not a routing one. Verified against the live CMS: /author/crossword, /author/movies and /author/news redirect; /author/sanjana-bandi and /author/by-nayab-iqbal still serve; /author/ryan-keating still 404s. Co-Authored-By: Claude Opus 5 --- src/pages/author/[author].astro | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/pages/author/[author].astro b/src/pages/author/[author].astro index db22ca4..45242ec 100644 --- a/src/pages/author/[author].astro +++ b/src/pages/author/[author].astro @@ -10,12 +10,28 @@ import Social from '../../components/Social.astro'; import Poll from '../../components/Polls.astro'; import '../../styles/global.css'; import { getAuthorArticles } from '../../utils/db'; +import { getSlugKind } from '../../utils/taxonomyStore'; import Scroll from "../../components/Sections/Scroll.astro"; const pageNum = 1; const authorData = author ? await getAuthorArticles(author, pageNum) : undefined; if (!authorData) { + // Most of what misses here is not a person. WordPress gave categories an + // author-shaped archive, so /author/crossword, /author/movies and + // /author/womens-basketball are all still indexed and still linked -- 31 of + // the 68 distinct slugs that 404'd on this route name a section or a + // subsection this site does serve, just at /. + // + // Only redirect on a definite answer. getSlugKind returns 'unavailable' when + // the CMS could not be read, and sending a real author's page to / + // during a blip would turn a brief outage into a confidently wrong redirect + // that caches. + const kind = author ? await getSlugKind(author) : 'unknown'; + if (kind === 'section' || kind === 'subsection') { + return Astro.redirect('/' + author, 301); + } + return Astro.rewrite('/404'); }