datasektionen / bawang

En inte längre ny hemsida. I nutiden. Som purjo fast klyftigare.
https://datasektionen.se
2 stars 4 forks source link

Add navbar sorting based on sort tag #55

Closed Herkarl closed 1 year ago

Herkarl commented 1 year ago

Sorts navbar items by the Sort-tag, if available.

Depends on taitan#22, but should work as before without it.

Herkarl commented 1 year ago

After discussion with @Benjaneb, I decided to change the default to order by title instead of implicitly by slug. Also nice because now the default order is explicit in bawang, rather than just running with whatever order the pages are sent in from taitan.

(if there is no title, the order would still be the same as what came from taitan, but I believe we can rely on that existing, since the page would look whack otherwise)

I am a bit unsure if I think localeCompare is the right choice, since the ordering is different for an english and a swedish locale (i.e. "Årsrapporter" being at the top of organization instead of the bottom for me) 2023-09-17-13:32:50

foodelevator commented 1 year ago

The second argument to localeCompare is the locale to use. I think the most correct thing to do is to use sv-SE when showing the website in Swedish and en-?? when showing the website in English. However, always using sv-SE should be fine, since sorting in Swedish is the same as in English for all letters in the English alphabet as far as I know.

Herkarl commented 1 year ago

Nice! I agree!