List of pages by custom attributes (only for filtered images)

Greetings!
After taking some time away from this project, I feel that we are ‘sooo close’ to the requirements for this simple website, but I am having trouble still (almost where I left off on the related issue: Suggestions for content type)

Utilizing the image processing features of making pages for each person seemed like the way to go.

The goal:

  • Putting titles above the listed lab members in order: by association

The end result being something like this:

Faculty
image image image
name name name

Post Docs
image image image
name name name

PhD Candidates
image image image
name name name

Emeriti
image image image
name name name

Here are the associated bits of the hugo site that I have almost accomplished this with:

Setting aside ambitions for an elegant solution, I thought that this might be as simple as putting something like a series of if statements:

{{ if eq .Params.affiliation "Faculty" }}
<h2>Faculty</h2>
{{ end }}

to add titles between the photos (and associated names) that are already output in the correct order.

However this isn’t working.
I have scoured the documentation on ordering lists and I have not been able to reach a point where I am able to craft the solution that I am after.

Seems like I need to grad the associations from the range of pages before I display the pages…

Any suggestions?

Could something like this be the correct way?

					<!-- Groups content according to content section.-->
				{{ range $s := .Data.Pages.GroupBy "Section" }}

When I try to approach this method, I get the following error:

execute of template failed: template: members/list.html:8:20: executing 
"content" at <.Params.affiliation>: can't evaluate field Params in type page.PageGroup

I am having trouble understanding how to get ‘work’ done in hugo and I would appreciate all helpful suggestions.

Many thanks!

Hi there,

It would be easier to help you if you had a repo demonstrating your issue that we could easily clone, instead of trying to create one hoping to match your setup. Have a read here about Requesting Help .

Thank you for the reply!
I kept reading other posts (and the docs) and was able to get to a very hack-ish solution.

I described it here: Sort grouped and sorted content based on custom slice