为什么 ReadTheDocs 不显示 "Last updated on"

Why doesn't ReadTheDocs show "Last updated on"

我有一个 documentation 由 ReadTheDocs 渲染和托管。它仍然显示 Git 提交哈希而不是 "Last updated on" 行,而我的本地 HTML 文档显示今天的日期。

本地版本:

网络版:

docs/conf.py 文件中,我将 html_last_updated_fmt 配置为非 None 值 -> 空字符串。
资料来源:https://github.com/VLSI-EDA/PoC/blob/master/docs/conf.py#L173-L176

为什么 ReadTheDocs 忽略了我的设置?如何获取最后更新日期?

如果修订信息可用 (here's the commit that introduced the change),ReadTheDocs 默认主题会将 Last updated 信息替换为修订信息。

要解决此问题,您可以创建并使用自定义主题。 这不是微不足道的。进行如下:

  • 派生 ReadTheDocs 主题。
  • "Undo" 我在上面引用的提交的更改。
  • 在文档的 requirements 文件中引用分叉。 Here,你可以看到一个需求文件的例子。但是,该文件通常应位于存储库的根目录中,并且名称为 requirements.txt.
  • 确保您的项目配置为支持 installation of custom requirements
  • 将所有更改推送到 GitHub。
  • 在 ReadTheDocs 上重建您的项目。