Hi, I have a taxonomy called “neighborhood”. I would like to list items by their neighborhood, but be able to dictate the order in which the neighborhoods are displayed. So if I have items belonging to neighborhoods “a”, “b”, and “c”, I 'd like to be able to tell hugo to display items with “c” neighborhood first, then “a”, then “b”.
I understand the ability to do this in the front matter. But I have a lot of items and maintaining all of their weights individually isn’t feasible. Is it possible to apply a weight to a taxonomy value as opposed to each individual item?
This depends on how you’ve architected the site. Are you talking about including “related” pages in a single-page layout that shows other items from the same neighborhood? Or are you talking about sorting by two different attributes (that is the weight and the neighborhood value)?
-
You could always range through the Taxonomies
and look for each of those values. That’s if you only have a
, b
, and c
. Then again, if it’s in the front matter, you could put that front matter key-value in a variable, and then set your templating to range through the taxonomy and only match the first n matching entries.
-
You could do some filtering on the client. This wouldn’t be too hard to write and you could add a dta attribute on each sectioning element.