Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting authors by name instead of date in people widget #1080

Closed
ccamara opened this issue May 14, 2019 · 6 comments
Closed

Sorting authors by name instead of date in people widget #1080

ccamara opened this issue May 14, 2019 · 6 comments

Comments

@ccamara
Copy link
Contributor

ccamara commented May 14, 2019

Authors on people widget are sorted randomly (or I cannot see a clear pattern). Even though they were sorted alphabetically, when adding new people (I have a staff of 11 people that I want to display on the widget) the sorting criteria changed.

This makes me wonder that it would be a nice have to, to implement a similar approach to other widgets in terms of choosing the sorting criteria, and possibly adding a new author_weight field for a custom sorting.

@ccamara
Copy link
Contributor Author

ccamara commented May 14, 2019

I am still debugging to figure out the sorting logics. I have realized that all the first authors, before Anat, have a published content each (a talk, to be more specific). Others do not have any talk. If I unlink the first author with the talk, it gets moved where it should belong: alphabetically sorted by name.

However, a part from that, it is not clear what kind of sorting follow the authors who have talk, as they do not follow alphabetical order.

Edit: I found out that authors are sorted according to linked content's date, on a descending order. IMHO this is not an expected/obvious behaviour.

@ccamara ccamara changed the title Sorting authors in people widget Sorting authors by name instead of date in people widget May 14, 2019
@ccamara
Copy link
Contributor Author

ccamara commented May 14, 2019

I have also discovered that my suggestion of ordering authors by weight is already implemented by default in Hugo (see Order contentsection on documentation) so now I am rephrasing my whole issue:

Would it be possible to arrange authors by Weight > LinkTitle > Date > FilePath instead of current Weight > Date > LinkTitle > FilePath?

@gcushen
Copy link
Collaborator

gcushen commented May 14, 2019

The override order is defined by Hugo team, so that would be a question for them.

Defining a 'weight' for each author is Hugo's method for allowing admins to customize the order.

We could force sorting by display name in People widget, but it might not be very helpful as for western names, that would usually order by first name.

@gcushen gcushen closed this as completed May 16, 2019
@nfaivre
Copy link

nfaivre commented May 21, 2019

Adding a weight variable for each author (content/author/author1/_index.md) has no effect on ordering for me... This is using hugo v0.55.6. Any idea why?

@happywhitelake
Copy link

happywhitelake commented Sep 6, 2019

@nfaivre, I added weight: <a_number> below name and it works for me in terms of arrange people shown on the front page. People with smaller number are shown first. I am using hugo-extended 0.58.0.

@andrewfowlie
Copy link
Contributor

andrewfowlie commented Apr 16, 2021

Can we have a solution as follows

  • add weight_alphanumeric entry
  • user can add whatever they want there. A common choice would be second name
  • the people are ordered according to alphanumeric sorting of the weight_alphanumeric entry by assigned them a weight = rank in that sort. This happens under the hood though

This would make it easier to add new people w/o worrying about ordering and order them based on whatever criteria we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants