Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Sitemap gives 1,003 generated reference pages a lastmod of 0001-01-01

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
hugo
领域
documentation

调研方向

从 layouts/sitemap.xml 开始,然后检查由 content/reference/cli/_content.gotmpl 生成的页面以及 Hugo 的 GitInfo 行为。在修改模板之前,运行或检查生成的 sitemap.xml;完成的标准是生成的参考页面不再将 <lastmod> 暴露为 0001-01-01,同时有效日期保持不变。该 issue 提到之前已关闭的 pull request 和一种替代方案,因此请与维护者确认这一做法。

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

描述

status/triage
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

环境准备

从这里开始

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

docker/docs 的其他 Issue

查看 docker/docs 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

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