Due to me being a new user i can’t post my full code for some reason
But here is the problem if you go into my github you will find members.html in the _defaults layout here are functions that are trying to filter wat data to display in a certain container. using the staff or student category you can see these being correctly applied in the members.yaml file
The filtes works when you leave “staff” or “student” empty as in it displays nothing but when u type in “staff” or “student” it displays al the cards not just the "staff or “student” cards
You have:
data/members.yaml
members:
- name: John Doe
bio: Software Engineer
image: /Img/blank-profile-picture-973460_960_720.png
url: /john/
category: staff
- name: Bob Smith
bio: Data Analyst
image: /Img/blank-profile-picture-973460_960_720.png
url: /bob/
category: student
The file itself is a data object, so you would need to range over site.Data.members.members. I suggest you make your data file an array, not a an object.
Also, you might want to consider using taxonomy (or even a separate content type) for this instead of a data file. Much easier to work with.
Could you give a basic example of how i would do this with taxonomy? I’m quite new at hugo and this looked like the easiest way, the taxonomies are still a bit confusing to me.
Here’s an example:
git clone --single-branch -b hugo-forum-topic-48874 https://github.com/jmooring/hugo-testing hugo-forum-topic-48874
cd hugo-forum-topic-48874
hugo server
In this case the taxonomy is authors. We can assign one or more authors to any a page, then click on the author name to get their info (bio, title, photo, whatever).
I’ve made a new branch on my github called “taxonomie-attempt” currently i’m trying to implement these but its not displaying any of my members, the documentation is a bit confusing atm
When I git checkout Taxonomy-attempt I see no change. Did you push your changes?
content/
├── contact/
│ └── contact.md
├── members/
│ ├── staff/
│ │ ├── John.md
│ │ ├── bob.md
│ │ └── mark.md
│ └── members.md
├── research/
│ └── research.md
└── _index.md
My bad the push did not go through, it did now
My bad the push did not go through now it did
This stuff in your front matter:
taxonomy:
member: true
category: staff
should just be:
category: staff
These pages are already in the members directory, so they are members.
If you feel you are at the beginning of a steep learning curve, you might just stick with what you know.