mmistakes / minimal-mistakes

:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.
https://mmistakes.github.io/minimal-mistakes/
MIT License
12.42k stars 25.6k forks source link

How to include collection posts in category-archive? #405

Closed philectron closed 8 years ago

philectron commented 8 years ago

Environment information


Expected behavior

I assigned the same category for two posts. I set one post in the _posts folder, and the other post in the _my-collection folder. I have already setup the declaration and front matters for my-collection:

# Collections
collections:
  my-collection:
    output: true
    permalink: /:collection/:path/

# Front Matter Defaults for _posts, _pages, and collections
defaults:
  # _my-collection
  - scope:
      path: ""
      type: my-collection
    values:
        layout: single
        author_profile: false
        share: true

I expected that once I go to /categories/, I should see two posts appear at the same category list.

My Issue

However, I didn't see the post in _my-collection appear in the list but only the other post in the _posts folder

I use your category-archive.html layout.

How should I edit the code so that it would search in _my-collection also? Thanks!

mmistakes commented 8 years ago

I don't think you can easily do this. Check out this thread on the Jekyll Talk forum for more info.

But essentially _posts has categories and tags support, while other collections do not. I'm sure it will eventually get addressed since posts are just another collection, but for now you're out of luck.

There may be a plugin out there that could do it, but guessing you're hosting on GitHub Pages which won't help you... since they're not allowed.

philectron commented 8 years ago

You're right. Only _posts has categories and tags support. I'm probably out of luck for now. Thank you!

asarkar commented 5 years ago

@mmistakes I'm glad that I searched, I was about to open a new ticket asking the same question. Almost 2.5 years have passed since this ticket was created, does the limitation on collections still exist? BTW, the link you referred to above no longer exists.

mmistakes commented 5 years ago

@asarkar Yes still a Jekyll limitation. There is a proposal for the next major version of Jekyll to harmonize collections if you want to weigh in.

https://github.com/jekyll/jekyll/issues/7296 https://github.com/jekyll/jekyll/issues/7202