I’m trying to figure out the best way to keep my product content files organized on page, meaning when I range through them they are displayed (with a header / view) in an order of categories.
Meaning, I have 9 product.md files, 3 are hair care, 3 are body care, and 3 are nail care. How could I structure my page to look like (with headers):
Hair care
List item
List item
List item
Nail care
List item
List item
List item
Bodycare
List item
List item
List item
The only way I can think of doing it this way is to loop through each category, but I’d like to keep my data dynamic. Is there a way that I can range through all of these and keep them in their categories on page?
You should be able iterate through taxonomy terms (assuming I’m not confusing taxonomies and term, as I often do) and then the taxonomies within each term, which gets you the categories and the pages in them.
I’ll try to get some time to create and post an example, ‘soon’ (unless someone beats me to it).
@jmooring Silly question, but is there an easy way to use a Param to so that categories is not hard-coded in your example above? (I can open a separate topic if need be).
Works perfectly, one last follow up question, how would you apply weights to this? (show first to last categories by specified weight or any other way of organizing)
It also depends on whether you want to sort the terms (e.g. the different categories) or the taxonomies themselves, or the pages with a term (e.g. ‘nail-care’ pages).
I’m specifically talking about the categories [nail-care, hair-care], I don’t see how I can set a weight with the WeightedPages how do I set those? Is that in the config?
To clarify, you would like the ability to specify an arbitrary order—not alphabetical, and not based on the number of pages associated with a particular term.
I’m sorry ONE last question, I’m trying to access my data from the range, but it seems it’s only the on page data since we’re parsing the tags / categories.
How would I be able to return my content file with the range? I don’t see the data with .Page.Data either.