Photo blog with extra images for members?

I guess this is something that could be done with the new role and matrix feature. Unfortunately the docs offer no in-depth knowledge about them yet.

My plan: I have a blog with a photo gallery in each post. Now I want that “members” of the blog can see all the photos of a gallery, while “guests” can only see selected ones.

Guests should visit https://example.com to see the limited blog. Members should go to https://example.com/member/ to see the essentially the same website, but with all the photos in the blog articles. (I would then restrict access to the /member/ path via web server, e.g. by basic auth.)

Files in the example blog article:

content/blog/20260412-hikingtrip/index.md
content/blog/20260412-hikingtrip/gallery/01.jpg
content/blog/20260412-hikingtrip/gallery/02.jpg

The restricted images should be in the same path, e.g.

content/blog/20260412-hikingtrip/gallery/03.member.jpg

What I tried so far: In the hugo.yaml, I added:

roles:
  guest:
    weight: 10
  member:
    weight: 20
defaultContentRole: guest

Hugo now creates a public/member/ directory, but it contains only an almost empty home page. On the guest part of the blog the restricted images are still visible.

Is it possible to generate such a “member gallery” with Hugo and roles?

I’m testing with hugo 0.159.2.

Thank you for your help!

03.member.jpg

The above is currently not a thing. We have historically allowed the language code to be in the filename, but I struggled to come up with a syntax without ambigouity issues. Currently this needs to be either set in the mount or in front matter (the latter is not possible for images). I will try to think of a way to fix this.

OK, so the “sites matrix” (language, version, role) is mostly focused on pages. The resources inhertited the logic we always had for languages, where (especially for images) it was important that we always had a value for all the variants. I just created a test that somehow mimics your setup, and I found the output slightly surprising. I agree that it would be useful to create a setup like what you describe without too much ceremony.

See Revisit the page resources logic epsecially for the role dimension · Issue #14749 · gohugoio/hugo · GitHub

With the latest Hugo (released today) this repo demonstrates some of what you asked for; GitHub - bep/hugo-testing-roles-gallery: Just a test repo. · GitHub

The Hugo release: Release v0.161.0 · gohugoio/hugo · GitHub