告诉 Jekyll(在 github 页上)将 README.md 转换为 README.html,而不是 index.html

Tell Jekyll (on github pages) to convert README.md to README.html, not index.html

我正在使用 Jekyll 在 Github 页面上构建一个项目网页,使用开箱即用的“Dinky”主题。

README.md会自动转换为index.html,对快速上手很有帮助。

但是,我想要一个单独编写的主页 index.md,而不是将 README.md 转换为 README.html(就像大多数 *.md 文件一样).当我添加我的 index.md 时,Jekyll 将它转换为 index.html,但现在根本不提供 README.md 的转换——大概它有 index.html 作为 index.html 的目标 README.mdindex.md,后者获胜。

如何告诉 Jekyll 返回使用 README.html 作为其 README.md 的转换目标?

最好,我想要一个不需要在README.md本身中添加配置数据的解决方案,这样我就可以继续保持README.mdmaster 分支中的人类可读版本同步。

复制它的注意事项:所有这些都发生在通过 Github 页面在线构建时,以及本地 jekyll build 构建时。我使用的唯一自定义 jekyll 设置是站点 Gemfile 中的 gem 'github-pages', group: :jekyll_plugins 和站点 _config.yml.

中的 theme: jekyll-theme-dinky

它似乎特定于 Github Pages 主题,而不是 Dinky 主题:除 Dinky 之外的其他主题表现出相同的行为,但一个裸露的 Jekyll 站点似乎没有。


编辑:感谢@wasthishelpful 的非常有用的评论和部分回答。将 YAML frontmatter 块添加到 README.md 设置 permalink: README.html 可以满足我的需求。不幸的是,我仍然没有找到一种方法来仅通过修改 _config.yml 来达到相同的效果:例如在那里添加一个 frontmatter default

defaults:
  - 
    scope:
      path: "README.md"
    values:
      permalink: "README.html"

好像没有什么效果。 (我试过在文件名周围加引号和不加引号,以及 theme: jekyll-theme-dinky 行前后)

您可以在 README.md 中使用 permalink:

---
permalink: README.html
---

TypeTheory: the mathematical study of type theories, in univalent foundations
==========

Code  on C-systems, D-systems, ...

您也可以在 _config.yml 中使用 front matter defaults:

defaults:
  - 
    scope:
      path: "README.md"
    values:
      permalink: "README.html"

但是你仍然需要在 README.md 中添加一个 front matter 来让它被 jekyll 解析(即使它是一个空的):

---
---

TypeTheory: the mathematical study of type theories, in univalent foundations
==========

Code  on C-systems, D-systems, ...

我了解到,如果您将 any frontmatter 添加到自述文件,它将停止将 README.md 变成 index.html。我通过将这个 frontmatter 添加到我的 README.md

中无意中发现了这一点
---
title: Design Your Bot
---