Front Matter Defaults with Collections configuration

Dear Jekyllers,

I’m encountering an issue with the following configuration file. Eveything works fine without adding collections:

gems:
- jekyll-paginate-v2
- jekyll-tagging
- jekyll-paginate-tags

include: ['_pages']
  
defaults:
  - scope:
      path: "_posts/press_en/"
      type: posts
    values:
      permalink: "/press/:year/:month/:day/:title/"
      category: "press_en"
  - scope:
      path: "_posts/blogs_en/"
      type: posts
    values:
      permalink: "/blogs/:title"
      category: "blogs_en"

pagination:
  enabled: true
  debug: false
  per_page: 8
  title: ':title'
  sort_field: 'date'
  sort_reverse: true
  trail:
   before: 2
   after: 2

tag_page_layout: tags
tag_page_dir: '/subject'
tag_permalink_style: pretty

But after adding collection configuration, it broke. Like the posts don’t show up in site.categories or jekyll-paginate-v2:

gems:
- jekyll-paginate-v2
- jekyll-tagging
- jekyll-paginate-tags

include: ['_pages']

collections_dir: "collections"
collections:
    press_archives_en:
      output: true
      permalink: "/press/archives/:title/"
    blogs_archives_en:
      output: true
      permalink: "/blogs/archives/:title/"
	  
defaults:
  - scope:
      path: "_posts/press_en/"
      type: posts
    values:
      permalink: "/press/:year/:month/:day/:title/"
      category: "press_en"
  - scope:
      path: "_posts/blogs_en/"
      type: posts
    values:
      permalink: "/blogs/:title"
      category: "blogs_en"

pagination:
  enabled: true
  debug: false
  per_page: 8
  title: ':title'
  sort_field: 'date'
  sort_reverse: true
  trail:
   before: 2
   after: 2

tag_page_layout: tags
tag_page_dir: '/subject'
tag_permalink_style: pretty

I can’t figure this out. What I’m doing is putting current posts (from 2022) inside _posts. I use Front Matter Defaults in _config.yml to group these into press_en and blogs_en categories.

I put archived posts (from 2020 and 2021) inside collections press_archives_en and blogs_archives_en.

I tested before without Front Matter Defaults, the collections configuration would work, so I assumed that this configuration should bring both Front Matter Defaults and Collections to life, but that’s not the case.

Any idea how to fix this?

Thanks in advance!

My website structure

_posts 
    /press_en
    /blogs_en
collections
    /press_archives_en
        /2020
            /_posts
        /2021
            /_posts
    /blogs_archives_en
        /2020
            /_posts
        /2021
            /_posts

_posts are collections too. That directory should go under (/ into) the collections/ directory.

@ashmaroli Thanks for the response! I found something in the documentation that I missed before. Could you give an example of how _posts should be configured in the configured collections folder?