Recover the /author URLs that WordPress and the import left broken - #88
Merged
Conversation
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 /<slug>, 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 /<slug> 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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-on from #86, found in the same logs. 68 distinct slugs were 404ing on
/v1/authors/<slug>/articles. They turned out to be two unrelated problems.1. Category archives under /author (31 slugs)
WordPress gave categories an author-shaped archive, so
/author/crossword,/author/moviesand/author/womens-basketballare indexed and still linked. This site serves all of that content — just at/<slug>.25 are subsections (
crossword,movies,sudoku,puzzles,satire,the-drawing-board,womens-basketball,philly-sports, …) and 6 are sections (news,opinion,sports,columns,entertainment,graduation). These now 301 to the page holding their content, via the cached taxonomy.2. Real people filed under a different slug (7 slugs)
The import derives an author's slug from the WordPress login, and the logins don't agree with the names the site links by. Four distinct shapes are live:
ryan-keatingrkeatingnayab-iqbalby-nayab-iqbalsanjana-bandi-2sanjana-bandistefan-kusmirekstefan-kusmirek-dev-thetriangle-orgRyan Keating has 59 articles and his author page was unreachable from every URL that names him.
No pattern covers all four, and the next import will invent a fifth. So this matches on the display name, which is the one thing they have in common — the CMS holds the right name in every case, only the slug is wrong. It also keeps working after the ETL fix changes the slugs.
src/utils/authorIndex.tsbuilds that index from a paged/v1/authorssweep and caches it in process, on thetaxonomyStorepattern: same TTL-plus-stale-fallback, same single-flight dedupe, same refusal to cache an empty result (an index with no authors would answer "no such person" for everyone). 875 authors, ~114 KB.The ETL half is DrexelTriangle/wordpress-etl#63, but that only lands on a reseed and covers only the
by-shape. These are live 404s now, so the recovery lives here.Cost
Both checks run only after the author lookup has already missed, so a page that resolves pays nothing. Both refuse to act on an indefinite answer —
getSlugKindreturnsunavailableandresolveAuthorSlugreturns null when the CMS can't be read, leaving the 404 in place rather than inventing a redirect during a blip that then caches.What still 404s, correctly
30 slugs are WordPress categories the CMS has no row for (
music-entertainment,restaurant-reviews,exhibits,wordsearch) or WordPress handles with no author record (beeboop,abuckingham,carter,kasey-shamis-temp). Dead on both sides.Verification
astro check: 0 errors. Dev server against the live CMS:🤖 Generated with Claude Code