Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[錯誤 Bug] travel-ai-briefing 三語輸出兩組 og/twitter 標籤,分享圖片不一致

Open
#662 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
markdown, python, yaml

Research direction

Start with the front matter of the three travel-ai-briefing.md files and the og/social settings in docs/layouts/anoni.yml, comparing them with a games/ page that has social: cards: false. Confirm that the duplicate og:image and twitter:image tags come from overrides/main.html plus the social plugin. The maintainer has not yet chosen between option A (add social.cards: false, fix the docs, optionally add a lint rule in docs_style_lint.py) and option B (have the plugin skip empty tags), so ask before editing. Done means a SOCIAL_CARDS=true build shows one set of og/twitter tags on those pages.

Written by the indexing model from the issue text.

Description

bug documentation
哪一頁 / Where

三語的 blog/posts/travel-ai-briefing.md:

問題描述 / What's wrong

#660 比對時發現、review 時確認可重現。這三頁輸出了兩組 og/twitter 標籤:overrides/main.html 依 og.enabled 輸出一組,social 外掛依 layouts/anoni.yml 的 tags 又插一組。標題、描述重複之外,兩組的圖片不一樣,正式站 en 版:

<!-- 第 18–21 行,main.html(og.enabled 指定的封面) -->
<meta property="og:image" content="https://assets.anoni.net/blog/travel-ai-briefing.png" />
<meta property="og:image:width" content="1536" />
<meta property="og:image:height" content="1024" />

<!-- 第 282–285 行,social 外掛自動產生的卡片 -->
<meta property="og:image" content="https://anoni.net/docs/en/assets/images/social/blog/2026/06/travel-ai-briefing.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

twitter:image 也是兩張。各平台遇到重複標籤怎麼選不一定,指定的封面不保證會被採用,外掛也多產了一張用不到的卡片。

同樣設了 og.enabled 的 games/ 4 頁只有一組,差別在它們的 front matter 多了:

social:
  cards: false

三語 15 個設了 og.enabled 的頁面裡,12 個 games/ 頁都有這兩行,3 個 travel-ai-briefing 都沒有。

但兩處說明都寫成只要設 og.enabled 就會自動跳過:

  • docs/layouts/anoni.yml 第 201–202 行:「front matter 寫了 og.enabled 的頁面由 overrides/main.html 自己出標籤,那些頁面會跳過這一段。」
  • 三語 community/visual-guide.md 第 134 行:「front matter 填 og.enabled: true 與 og.image,文件站的模板會改用指定的圖片,並跳過自動產生的那一張。」

實際上跳過靠的是 social.cards: false,照說明只寫 og.enabled 就會重複。

建議修正 / Suggested fix

兩個方向,想請維護者決定:

A. 補設定、改說明(改動小)

  • 三語 travel-ai-briefing.md 的 front matter 補 social: cards: false。
  • layouts/anoni.yml 的註解與三語 visual-guide.md 改成「要同時寫 og.enabled 與 social.cards: false」。
  • 選擇性:docs_style_lint.py 加一條,og.enabled: true 卻沒有 social.cards: false 時報錯,之後的新頁面不會再漏。

B. 讓說明變成真的(自動跳過)

  • social 外掛只輸出值不是空字串的標籤(plugin.py 的 if content)。layouts/anoni.yml 的 tags 每一項在 page.meta.og.enabled 時回傳空字串,這些頁面就不會有第二組。
  • 不用動文章,說明也不必改。代價是 tags 的每一項都要包一層判斷,外掛仍會產卡片圖(用不到但無害)。

我傾向 A 加 lint 規則:跟 games/ 現有的寫法一致,規則也看得見。改的時候會用 SOCIAL_CARDS=true 三語建置,確認這三頁只剩一組標籤,其他頁的 og/twitter 標籤不變。

Dominant language
JavaScript
Stars
52
Forks
7
Avg merge
1h 35m
Merged PRs (30d)
63

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anoni-net/docs

All issues in anoni-net/docs

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.