在 Jekyll 中哪里可以找到默认布局
Where to find default layouts in Jekyll
新 Jekyll 站点的默认站点设置在 index.md
中指定为 "home" 的布局:
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---
如果我按照 link,它会告诉我创建一个 _layouts
文件夹并在其中创建一个名为 home.html
的文件,该文件将用作主页布局。但如果该文件不存在,Jekyll 默认返回正常主页。
Jekyll 从哪里提取默认布局?
此默认布局来自主题,该主题基于 gem 并存储在您的计算机上。
To locate a theme’s files on your computer:
Run bundle show followed by the name of the theme’s gem, e.g., bundle show minima for Jekyll’s default theme. This returns the location of the gem-based theme files. For example, the Minima theme’s files might be located in /usr/local/lib/ruby/gems/2.3.0/gems/minima-2.1.0
on macOS.
我建议从没有主题开始。不可见的文件并不能真正帮助您理解一个已经相当抽象的概念。删除主题并编写自己的布局和 CSS。当您了解它的工作原理时,您也会真正了解主题的工作原理以及它能做什么和不能做什么。
删除标准(或任何其他)主题很简单。只需转到 _config.yml
文件并删除 theme: minima
。现在您将只使用可见文件。您可能还想删除 'Gemfile',但这需要您还从配置中删除 'jekyll-feed' 插件。没问题,因为您可以轻松地自己滚动:https://jekyllcodex.org/without-plugin/rss-feed/
Run bundle info --path
followed by the name of the theme's gem, e.g., bundle info --path minima
for Jekyll's default theme.
布局文件将位于上述命令返回路径的 _layouts
子目录中。
新 Jekyll 站点的默认站点设置在 index.md
中指定为 "home" 的布局:
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---
如果我按照 link,它会告诉我创建一个 _layouts
文件夹并在其中创建一个名为 home.html
的文件,该文件将用作主页布局。但如果该文件不存在,Jekyll 默认返回正常主页。
Jekyll 从哪里提取默认布局?
此默认布局来自主题,该主题基于 gem 并存储在您的计算机上。
To locate a theme’s files on your computer:
Run bundle show followed by the name of the theme’s gem, e.g., bundle show minima for Jekyll’s default theme. This returns the location of the gem-based theme files. For example, the Minima theme’s files might be located in
/usr/local/lib/ruby/gems/2.3.0/gems/minima-2.1.0
on macOS.
我建议从没有主题开始。不可见的文件并不能真正帮助您理解一个已经相当抽象的概念。删除主题并编写自己的布局和 CSS。当您了解它的工作原理时,您也会真正了解主题的工作原理以及它能做什么和不能做什么。
删除标准(或任何其他)主题很简单。只需转到 _config.yml
文件并删除 theme: minima
。现在您将只使用可见文件。您可能还想删除 'Gemfile',但这需要您还从配置中删除 'jekyll-feed' 插件。没问题,因为您可以轻松地自己滚动:https://jekyllcodex.org/without-plugin/rss-feed/
Run
bundle info --path
followed by the name of the theme's gem, e.g.,bundle info --path minima
for Jekyll's default theme.
布局文件将位于上述命令返回路径的 _layouts
子目录中。