Skip to content

Sort authors in a group #1919

Answered by chrede88
gferman asked this question in Q&A
Oct 28, 2020 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

It's not straightforward! It requires some changes to the people.html partial and all the people displayed on your website.

Firstly people.html:

  1. Place this file (https://github.com/wowchemy/wowchemy-hugo-modules/blob/master/wowchemy/layouts/partials/widgets/people.html) in ./layouts/partials/widgets/. Create the missing folders.
  2. Change line 32 from {{ range $query }} to {{ range sort $query "Weight" }}
    Changing this line will sort the people within each group by the parameter weight.

Now add the parameter weight to all the people (authors) defined for your website.
For author <johndoe> add the parameter to ./content/authors/<johndoe>/_index.md

The sort is by default ascending, so weight…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@chrede88
Comment options

@cschaffner
Comment options

@wangyufan216
Comment options

@cschaffner
Comment options

@gferman
Comment options

Answer selected by gferman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants