I’d like to have two pages with lists of posts. Currently the blog page is being populated ok, but the other page is not being populated even though I’ve set them up the same way.
I don’t understand why the posts on the page I’m trying to create don’t populate.
site.posts is a thing - but unless you setup a collection called portfolio site.portfolio won’t work.
You could try doing them both as posts but using categories - you can use a folder named blog and have a _posts folder inside it, then they will all be category = blog, you could then have a folder named portfolio with a _posts folder inside it and then those would be category = portfolio. You could then filter site.posts to just get the ones that match a given category.
Or you could probably do them as collections, depends on if you are using any of the posts features which maybe the archive.html is.
I also tried the solution of _posts in separate folders.
It doesn’t work either, now nothing shows.
portfolio → _posts
blog → _posts
blog.html is now:
---
layout: archive
title: ""
permalink: /blog/
author_profile: false
---
{% include base_path %}
{% for post in site.blog if post.category == blog %}
{% include archive.html %}
{% endfor %}
portfolio.html
---
layout: archive
title: ""
permalink: /portfolio/
author_profile: false
---
{% include base_path %}
{% for post in site.portfolio if post.category == portfolio %}
{% include archive.html %}
{% endfor %}
Need to do one step at a time - if you do it as posts just use the folder structure but don’t try to use the category yet - just see if you can get both pages to show all the posts. Then work on showing just one category.
If you do it as a collection, my comment was there may be something in the archive include that is only going to work on posts. I would not use it and would just output the title on your own.
I don’t think that is the correct syntax - did you see that somewhere? or are you just trying random things?
try
{% for post in site.categories.blog %}
I don’t know all the category ins and outs off the top of my head, a qucik google search for jekyll posts category got me a bunch of results like this that look good:
keep in mind there are different ways to do things - like the cat can be set via sub folder or front matter, that example uses front matter.