Preview checker: `<meta>` tags inside a `<script>` string override the real ones
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- backend
Rechercherichtung
Beginne mit parseMetaTags() in src/lib/meta-fetcher.ts und den Tests für diesen Parser. Prüfe, wie Kommentare entfernt werden, und ergänze Tests für Script-Elemente mit Attributen und gemischter Groß- und Kleinschreibung, einschließlich JSON-LD und mehreren Scripts. Füge einen Regressionstest hinzu, der zeigt, dass Tags innerhalb von Scripts die Ergebnisse für Titel, Meta und Canonical nicht beeinflussen, während Tags außerhalb von Scripts wie bisher geparst werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
parseMetaTags() in src/lib/meta-fetcher.ts strips HTML comments before it looks for tags (#389), but it still reads tags out of <script> contents. In HTML a script's contents are plain text, so a browser never sees tags written inside a JavaScript string, but the checker does, and a later meta tag overwrites an earlier one:
parseMetaTags(`
<meta property="og:title" content="Pricing | Acme">
<script>const share = '<meta property="og:title" content="Untitled">';</script>
`, 'https://example.com').ogTitle
// "Untitled"
It goes the other way for the tags where the first one wins: a <title> or <link rel="canonical"> inside a script before the real ones is picked instead, so a page gets Draft and https://acme.dev/draft instead of Pricing | Acme and https://acme.dev/pricing.
What to do
- Remove
<script>elements with their contents (any attributes, any case) right after the comments are stripped, so everything below works on HTML without them. A non-greedy match up to the first</script>is enough, since that's where HTML ends a script too.
Acceptance criteria
- A
<title>,<meta>or<link>inside a<script>, before or after the real tag, never changes the result - Tags outside scripts parse the same as today, including a page with several scripts and a
<script type="application/ld+json"> - A test that fails on the current code
-
npm run check,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #NUM in the description.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 8
- Forks
- 4
- Ø Merge
- 8 Std. 44 Min.
- Gemergte PRs (30 T.)
- 159
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus codercops/ogcops
-
Preview checker: a `<title>` written over several lines keeps its line break and indentationEvtl. vergeben @bhushan4work hat das vor 1 Tag übernommen. Offenbug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
codercops/ogcops#393 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] “Copy Recommended Meta Tags” generates an unusable placeholder image URLEvtl. wieder frei @CreatorguyS hat das vor 7 Tagen übernommen, und es ist kein Pull Request offen. Offenbug enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
codercops/ogcops#378 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Add the Do and Don't tutorial template (`tutorial-do-dont`)Evtl. vergeben @Ravindar-Amogh-Gummadavelly hat das vor 7 Tagen übernommen. Offengood first issue templates
codercops/ogcops#355 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
codercops/ogcops#341 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in codercops/ogcops
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 86/100
ranxianglei/billion-context#5893 ·
Maintainer antworten meist innerhalb von 1 Tag
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement security severity:low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Battle-Cattle/BCUK-Bot-4#959 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apartEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenaccount-pool bug gui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
lidge-jun/opencodex#8286 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag