cryptic0
cryptic0

Reputation: 245

Jekyll: Group some collections but not all

I need to group some of the collections so that I can password protect that group. At the same time I want to keep the _posts collection open, so it needs to remain at the root of jekyll.

For example, this is group secure

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

How can I exclude the collections such as _posts and also custom ones being grouped under secure?

Can I use permalinks to achieve this? For example

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

Upvotes: 1

Views: 38

Answers (1)

cryptic0
cryptic0

Reputation: 245

Answering my own question. The permalinks option is in fact best in this situation. That way _posts remains at the root of jekyll and other collections which do not need to be grouped are also behaving normally.

Once you build the site, all grouped collections will be under _site/secure/ locally and will be under http://example.com/secure/ on your server. Make sure to set up http authentication using htpasswd. There is plenty of material on the web on how to do this.

Upvotes: 1

Related Questions