Jekyll-如何仅为主页设置YAML front matter默认值?
我目前正在使用Jekyll开发一个个人博客(用于简易安装指南)。我正在尝试重新使用HTML文件,以便一个urlJekyll-如何仅为主页设置YAML front matter默认值?,jekyll,yaml-front-matter,Jekyll,Yaml Front Matter,我目前正在使用Jekyll开发一个个人博客(用于简易安装指南)。我正在尝试重新使用HTML文件,以便一个url“/”显示一些文本,而另一个url“/posts”显示一些稍有不同的内容。为此,我试图在\u config.yml中设置一个仅适用于其中一个路径的主路径“/” 下面是我用来设置字体默认值的代码: # site defaults (https://jekyllrb.com/docs/configuration/) defaults: - scope: path: ""
“/”
显示一些文本,而另一个url“/posts”
显示一些稍有不同的内容。为此,我试图在\u config.yml
中设置一个仅适用于其中一个路径的主路径“/”
下面是我用来设置字体默认值的代码:
# site defaults (https://jekyllrb.com/docs/configuration/)
defaults:
- scope:
path: ""
values:
display_num_posts: 5
我面临的问题是path:“
适用于所有页面,因此我的变量display\u num\u posts
将在使用HTML文件的每个页面上设置为5
(“/”
和“/posts”
)
我的问题是:如何设置只包含主页的路径?在url中没有额外的“/posts”
我试图在页面上搜索,但找不到答案。我还尝试设置
路径:“/”
,但该路径与任何url都不匹配。显然,这可以通过如下方式将路径设置为基本index.html
文件来实现:
# site defaults (https://jekyllrb.com/docs/configuration/)
defaults:
- scope:
path: "index.html"
values:
display_num_posts: 5
我发现这是可能的
希望这能像帮助我一样帮助别人