Jekyll:对一些集合进行分组,但不是全部

Jekyll: Group some collections but not all

我需要对一些集合进行分组,以便我可以用密码保护该组。同时我想保持 _posts 集合打开,所以它需要保留在 jekyll 的根目录中。

例如,这是组 secure

collection:
  notes:
    output: true
  hybrid: 
    output: true
collections_dir: secure

如何排除 _posts 等集合以及分组在 secure 下的自定义集合?

我可以使用固定链接来实现吗?例如

collection:
  notes:
    output: true
    permalink: /secure/:path/
  hybrid:
    output: true
    permalink: /secure/:path/

回答我自己的问题。在这种情况下,永久链接选项实际上是最好的。这样 _posts 仍然是 jekyll 的根,其他不需要分组的集合也表现正常。

一旦您构建了站点,所有分组的集合将在本地 _site/secure/ 下,并且在您的服务器上将在 http://example.com/secure/ 下。确保使用 htpasswd 设置 http 身份验证。网上有很多关于如何执行此操作的 material。