Preview checker: a long `og:title` or `og:description` gets no warning when the page also has a normal title and description
維護者通常 2 天內回覆
@Imhamza86 已經在處理了。
開始於 2026年12月4日。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 88/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
- 領域
- backend
研究方向
從src/lib/meta-analyzer.ts開始,閱讀現有的標題和描述長度檢查,接著檢視tests/lib/meta-analyzer.test.ts中的相關案例。補充涵蓋較長的 Open Graph 值與一般值,以及文字相符與不同的情況。指定的警告和分數扣減都已涵蓋、現有的備援行為獲得保留,且列出的檢查全部通過,即代表完成。
由索引模型根據 Issue 內容生成。
描述
analyzeMeta only checks the length of one title and one description: tags.title || tags.ogTitle and tags.description || tags.ogDescription (src/lib/meta-analyzer.ts lines 21 and 35). So when a page has a <title> and a meta description, the og:title and og:description never get measured, and those are the ones the social previews show.
I ran parseMetaTags and analyzeMeta on the current dev with a page where everything else is set:
everything normal → score 100 (A), no issues
og:title is 116 chars → score 100 (A), no issues
og:description is 418 chars → score 100 (A), no issues
<title> is 116 chars → score 95 (A), "Title is 116 chars (recommended: under 70)"
#333 made the title check fall back to og:title when there's no <title>. This is the other half: a page that has both.
What to do
- After the current title check, also check
og:titlewhen it's set and isn't the same text as the title that was just checked. Over 70 characters gives a warning on theog:titletag, likeog:title is 116 chars (recommended: under 70), and takes 5 points like the title does. - Do the same for
og:descriptionover 160 characters, as a warning on theog:descriptiontag that takes 3 points like the description does. - When there's no
<title>or no meta description, keep what happens now: the Open Graph value is the one that gets checked, once. - The "too short" description warning stays as it is, this one is only about values that are too long.
- The test
prefers the HTML title when both title sources are presentintests/lib/meta-analyzer.test.tsexpects no warning for exactly this case, so it has to change.
Acceptance criteria
- A 116 character
og:titlenext to a normal<title>gets theog:titlewarning and scores 95 - A 418 character
og:descriptionnext to a normal description gets theog:descriptionwarning and scores 97 - A long
<title>and a longog:titlewith different text get one warning each - The same long text in
<title>andog:titlegets one warning, not two - Pages without a
<title>or meta description come out exactly as before - A test that fails on the current code
-
npm run check,npm run testandnpm run buildpass
How to test
Run the new tests, then npm run dev, open /preview and check a page with a short <title> and a long og:title. The report should list the og:title warning.
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 #458 in the description.
- 主要語言
- TypeScript
- 星號
- 8
- 分支
- 4
- 平均合併
- 1 天 21 小時
- 30 天內合併 PR
- 34
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codercops/ogcops 的其他 Issue
-
Preview checker: a page that only has `og:image:url` is reported as having no image可能已有人在做 @MugdhoAI 今天認領。 未關閉bug good first issue
難度 2/5 1-3 小時 新手友好度 88/100
codercops/ogcops#455 · 2 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
[Bug] “Copy Recommended Meta Tags” generates an unusable placeholder image URL可能重新可做 @CreatorguyS 於 34 天前認領,目前沒有進行中的 PR。 未關閉bug enhancement
難度 2/5 1-3 小時 新手友好度 72/100
codercops/ogcops#378 · 4 則留言 ·
維護者通常 2 天內回覆
-
good first issue templates
難度 3/5 1-2 天 新手友好度 76/100
維護者通常 2 天內回覆
-
good first issue templates
難度 3/5 1-2 天 新手友好度 78/100
維護者通常 2 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 30/100
codercops/ogcops#341 · 2 則留言 ·
維護者通常 2 天內回覆
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 68/100
Vessel9817/onion-site-template#512 ·
維護者通常 1 天內回覆
-
nightly-tests
難度 2/5 1-3 小時 新手友好度 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
維護者通常 1 天內回覆
-
approved
難度 2/5 1-3 小時 新手友好度 85/100
fritzprix/libr-agent#3266 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
better-auth/better-auth#13101 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆