in most of my themes I added a default content type called posts. This works fine in most cases. Therefore, I hardcoded the used content types in the pagination as follows:
Now, a user requested that he uses different stylings depending on the content type. This custom content types should also be listed in the pagination.
To give users more flexibility I thought about adding an array of strings in the config file that contains all other content types that should be added to the pagination.
Does someone knows an elegant approach to merge the posts of all content types in the $paginator variable?
I’ve tried the your snippet but the comparison, if the type is in the array of custom content types, is always false. Therefore, the paginator doesn’t contain any pages.
In my config.toml I created an array of custom content types:
custom_content_types = ["projects", "post"]
The content folder contains both content types that I listed above:
but where can’t handle functions as first parameter. I get the following error message:
ERROR: 2016/03/08 15:37:29 general.go:203: Error while rendering homepage: template: theme/index.html:6:32: executing “theme/index.html” at <where .Site.Pages "i…>: error calling where: in isn’t a field of struct type *hugolib.Page