Sitemap gives 1,003 generated reference pages a lastmod of 0001-01-01
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- hugo
调研方向
从 layouts/sitemap.xml 开始,然后检查由 content/reference/cli/_content.gotmpl 生成的页面以及 Hugo 的 GitInfo 行为。在修改模板之前,运行或检查生成的 sitemap.xml;完成的标准是生成的参考页面不再将 <lastmod> 暴露为 0001-01-01,同时有效日期保持不变。该 issue 提到之前已关闭的 pull request 和一种替代方案,因此请与维护者确认这一做法。
由索引模型根据 Issue 内容生成。
描述
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
There's a problem with the website
Description
The sitemap gives 1,003 of its 2,204 entries a <lastmod> of 0001-01-01. For example, docker container run:
<loc>https://docs.docker.com/reference/cli/docker/container/run/</loc>
<lastmod>0001-01-01</lastmod>
Every affected page is a generated reference page: the docker and sbx CLI references, and the Sandboxes, Hub, DVP, AI Governance and Registry API references. Anything that reads the sitemap takes that date at face value, so these pages look like they never change.
As far as I can tell, the cause is that these pages are built by Hugo content adapters such as content/reference/cli/_content.gotmpl, so they have no file in git. With enableGitInfo: true, Hugo takes Lastmod from git, so for these pages it stays at Go's zero time, and layouts/sitemap.xml prints it as is.
Location
https://docs.docker.com/sitemap.xml
Suggestion
One fix is to leave <lastmod> out when the date is zero, which is what Hugo's embedded sitemap template does. The element is optional in the sitemap protocol.
I opened #26365 with that change before filing an issue, which in hindsight was the wrong order. It's closed, and I'm filing this so the problem is tracked either way. I'm happy to rework it if you'd prefer a different approach, such as having the content adapters set a date, or to leave the fix to you.
- 主要语言
- Markdown
- 星标
- 4.7k
- 派生
- 8.5k
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 135
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
docker/docs 的其他 Issue
-
[docs-scanner] Broken sentence in environment variables documentation可能已有人在做 @nielskaspers 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
[docs-scanner] Example uses deprecated Flocker volume driver可能已有人在做 @aevesdocker 于 1 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
status/triage
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
bug documentation
难度 1/5 1 小时以内 新手友好度 92/100
qatrackplus/qatrackplus#913 ·
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 68/100
jhspetersson/fselect#187 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
drevendev/BeautifulRepo#42 ·
维护者通常 1 天内回复