Drop the "by-" a WordPress login leaves on an author slug - #63
Open
ssavutu wants to merge 1 commit into
Open
Conversation
A few accounts were registered with the byline text as the login, so the slug built from that login carries a "by-" the display name never had: the CMS holds by-nayab-iqbal, by-lena-tran, by-jack-davis and by-anum-hassan while their display names are correct and every link says /author/nayab-iqbal. _AUTHOR_CLEAN_PATTERN already strips this from names. It cannot be reused on a slug -- it also strips digits, which would rewrite the numeric suffix dedupe_slug adds to break collisions -- so this is a separate anchored, dash-terminated pattern. canonicalize_slug has already collapsed the separator by then, so "By Nayab Iqbal" and "by_nayab_iqbal" both arrive as "by-nayab-iqbal", while a surname like Byrne arrives as "byrne" and is left alone. Note this only takes effect on the next reseed, and it only covers this one shape. It does not touch the larger defect it is a symptom of: the slug comes from the login at all, so an abbreviated login gives Ryan Keating the slug "rkeating" and an email-style login gives Stefan Kusmirek "stefan-kusmirek-dev-thetriangle-org". Preferring the display name would fix that class outright but rewrites slugs for all 875 authors, so it wants its own decision rather than riding along here. tests/test_author_login_slugs.py covers the prefix, the separator spellings, the surname that must survive, the display-name fallback, and the collision that stripping can create. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 8, 2026
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.
Latent until the next reseed. The live 404s this describes are fixed on the site side in Scalene#88, which needs no reseed. This is the root-cause half.
The defect
A few WordPress accounts were registered with the byline text as the login, so the slug built from that login carries a
by-the display name never had:by-nayab-iqbalby-lena-tranby-jack-davisby-anum-hassanThe name is right, so nothing looks wrong on the page — but the author's URL is
/author/by-nayab-iqbalwhile every link and every indexed URL says/author/nayab-iqbal, which 404s._AUTHOR_CLEAN_PATTERNalready strips this from names. It can't be reused on a slug: it also strips digits, which would rewrite the numeric suffixdedupe_slugadds to break collisions. Hence a separate anchored, dash-terminated pattern.canonicalize_slughas already collapsed the separator by that point, so"By Nayab Iqbal"and"by_nayab_iqbal"both arrive asby-nayab-iqbal, while a surname like Byrne arrives asbyrneand is left alone.What this does not fix
This is one shape of a larger defect: the slug is derived from the login at all. Same root cause, not covered here:
rkeating— abbreviated login. Ryan Keating has 59 articles and his page was unreachable from every URL that names him.stefan-kusmirek-dev-thetriangle-org— email as login.sanjana-bandi-2— WordPress's duplicate-account suffix, where the CMS holds onlysanjana-bandi.Preferring
display_nameoverloginwould fix the class outright, but it rewrites slugs for all 875 authors and invalidates the URLs that currently work. That wants its own decision rather than riding along here.Tests
tests/test_author_login_slugs.py— the prefix, the separator spellings, the surname that must survive, the display-name fallback, and the collision stripping can create (jack-davis+by-jack-davis).Note:
tests.test_article_author_linksandtests.test_conflict_cachefail on this branch, but they also fail on cleanmain— unrelated and pre-existing.🤖 Generated with Claude Code