Add a social preview image (og:image) to the Pages site

未关闭 适合新手
#35 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
html, python
领域
documentation

调研方向

从 overrides/main.html 开始,阅读 extrahead 块,它已经会输出 og:title、og:description、og:url 和 twitter:card;确认它通过 mkdocs.yml 中的 theme.custom_dir 被纳入。将 1200x630 的 PNG 添加到 docs/assets/ 下,然后添加 og:image、width/height 和 twitter:image meta 标签,并将 twitter:card 切换为 summary_large_image。用 python scripts/prepare-mkdocs.py 和 mkdocs build --strict 验证,然后检查 site/index.html 中的 og:image,以及所引用的图片确实能加载。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue severity: low

Summary

Shared links to the site now carry a title and description (Open Graph and Twitter tags), but no image. Most chat apps and social feeds show a bare text card without one, which is easy to scroll past.

Where

  • overrides/main.html (extrahead block)
  • mkdocs.yml (theme.custom_dir)

Details

overrides/main.html emits og:title, og:description, og:url, and twitter:card set to summary. There is no og:image or twitter:image, because the repo has no image made for previews.

Suggested fix

Add a 1200x630 PNG (for example docs/assets/social-card.png) with the project name and tagline, then in overrides/main.html add:

<meta property="og:image" content="{{ config.site_url }}assets/social-card.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:image" content="{{ config.site_url }}assets/social-card.png">

and switch twitter:card to summary_large_image. Material's built-in social plugin is an alternative, but it needs Cairo and Pillow system libraries in CI.

Acceptance criteria

  • Every built page has og:image pointing to an image that loads.
  • mkdocs build --strict still passes.

Getting started

  • Relevant files: overrides/main.html, mkdocs.yml
  • How to check: python scripts/prepare-mkdocs.py then mkdocs build --strict, and look for og:image in site/index.html.

Filed by repo-audit/pages-site at c8f223f. Severity: low. Effort: S. audit-key: enhancement|overrides/main.html|og:image

主要语言
Python
星标
2
派生
5
平均合并
2 天 17 小时
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/Awesome-Ads 的其他 Issue

查看 TMHSDigital/Awesome-Ads 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。