18F / analytics.usa.gov

The US federal government's web traffic.
https://analytics.usa.gov
Other
724 stars 192 forks source link

Reorder Dropdown order #366

Closed gbinal closed 8 years ago

gbinal commented 8 years ago

It seems that the dropdown is ordered alphabetically by page filename (here). We should change this so that it's in this order:

gbinal commented 8 years ago

@cacraig - I see that you've got a PR in for it, but couldn't tell how it operated. Is there a file to edit that changes the dropdown?

konklone commented 8 years ago

@gbinal The PR uses Jekyll's templating system to reorder the agency names during the rendering process, rather than editing a static file. So it should automatically handle all new added agencies going forward.

cacraig commented 8 years ago

Yep! No need to worry about it in the future, @gbinal

gbinal commented 8 years ago

Sorry for being dense, but I'm still struggling to grok it. I guess I'm wondering where the order is determined or rather, if there was a desire to reorder it, where one could.

cacraig commented 8 years ago

@gbinal -

{% assign agencies = site.agencies | sort:"name" %}

This sets the variable agencies, which is sorted on the attribute "name".

If you wanted to change it to sort descending, you would do something like: {% assign agencies = site.agencies | sort:"name" | reverse %}

See: https://jekyllrb.com/docs/templates/

konklone commented 8 years ago

@gbinal In other words, there's no way in this implementation to tweak the ordering to make exceptions. It's fully alphabetical.

If you want to be able to tweak the order, then we can maintain the list manually, but that means always maintaining the list manually.

gbinal commented 8 years ago

Roger. I'm cool with that. The only change I'd have made is putting USAID after the Departments, but it's not worth more effort at this point.

Thanks for resolving folks and sorry you had to walk me through it a bit.