Strip the publisher suffix from article titles before publishing #155
Labels
No labels
bug
devops
duplicate
enhancement
good first issue
layout
next major release
next minor release
question
research
testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lvl0/fedi-feed-router#155
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Article titles carry the publisher's site name as a trailing suffix, and it is
published to Lemmy verbatim:
The
| VRT NWS Nieuwsis noise. It repeats on every post from that feed, eatsinto the title length, and tells a reader nothing they cannot see from the link.
Where it comes from
VrtArticlePageParser::extractTitle()reads, in order:<meta property="og:title"><h1><title>Publishers routinely append their site name to both
og:titleand<title>forsearch and social previews. The
<h1>usually carries the bare headline, but itis only reached when the meta tag is absent.
BelgaArticlePageParserandGuardianArticlePageParserhave the same shape, sothis is not VRT-specific — The Guardian appends
| The Guardianby the sameconvention.
Approach
Strip a trailing separator-plus-site-name from the extracted title. The
separator is usually
|but-and—are also common.Two ways to decide what to strip:
Per-provider suffix, configured.
config/feed.phpalready holds per-providerconfiguration, so each provider could declare the suffix to remove. Explicit and
predictable, but needs updating when a publisher changes their branding.
Generic trailing-segment rule. Strip the last
|-delimited segment when itmatches the feed or provider name. Needs no configuration and handles new
providers, but risks eating a real title that happens to end in a pipe.
Leaning toward the configured suffix: there are three providers, the values
rarely change, and a wrong guess silently mangles headlines.
Worth deciding
extractTitle(), or once ina shared place after extraction. A shared helper avoids three copies of the
same logic and gives one place to test.
suffix. A backfill is possible but articles are pruned after 30 days
(
CleanupArticlesJob), so doing nothing resolves it within a month.the clean title is simpler; storing the original and cleaning at publish keeps
the source text intact. Extraction seems right — nothing else reads the
suffix.
Acceptance criteria
| VRT NWS Nieuws