Really struggling with the template functions for taxonomies. I need 3 sidebar range queries for my site’s side bar.
If home page
So far, I’m just showing the first 4 oldest posts in reverse. But I would prefer a range query that only picks posts that aren’t already displayed in the main range queries.
{{ range first 4 .Pages.Reverse }}
<-- HTML -->
{{ end }}
I’d like the single page sidebar to show posts from the same cats as the single post. I’m close with this one, but I’m struggling to populate the cats dynamically and as a list.
{{ range .Site.Pages}}
{{ if in .Params.categories "[mycat1, mycat2]" }}
<-- HTML -->
{{ end }}
{{ end }}
I see some minor syntax issues with what you have above (e.g. }), but it would really help if you could give the community a link to your source so that we can test locally.
Sorry bud. Can’t help you much. There are a whole slew of things that might be going wrong for you with this. For example, are you declaring your taxonomies in your config? Are you getting any errors in the console? I’m also not sure what you mean by “picks posts that aren’t already displayed in the main range queries.” The only thing I can think of w/r/t your if not question is:
...
{{ if and (not in .Params.categories "mycat1") (not in .Params.categories "mycat2")}}
{{ end }}
...
I suggest you make a smaller project that is public, and include the templates you are working with. Not only will you get a repo to share, you will likely progress on the issue when putting it together.