如何在 Jekyll 的站点根目录中引用“_pages”?

v.k*_*chy 3 yaml jekyll

我在 GitHub Pages 上托管了 Jekyll 网站。该文件_config.yml包含以下内容(摘录):

# Defaults
defaults:
  # _pages
  - scope:
      path: "_pages"
      type: "pages"
    values:
      layout: "single"
      read_time: true
Run Code Online (Sandbox Code Playgroud)

因此,当网站建立后,我可以通过其 URL 打开一个页面,如下所示: https://repo.github.io/_pages/some-page/

我阅读了 Jekyll 的所有文档,但我不清楚如何将此 URL 变为https://repo.github.io/some-page/或可能https://repo.github.io/pages/some-page/

ash*_*oli 5

_pages可以看作是collection目录。因此,只需进行以下配置:

collections:
  pages:
    output: true
Run Code Online (Sandbox Code Playgroud)

会给你类似的网址https://repo.github.io/pages/some-page.html

要获取自定义 URL,您可以添加子permalink配置:

collections:
  pages:
    output: true
    permalink: /:collection/:path/
Run Code Online (Sandbox Code Playgroud)

会给你类似的网址https://repo.github.io/pages/some-page/

更多的可能性,请参考官方文档