Multiple config params for single content

Hi,
I’ve several config and params per each config. I would like to pass multiple params to single content where that content should be visible for dealers and employees. Can it be possible ? Below did not worked for me

config
├── _default
│   └── config.toml
├── dealers
│   ├── config.toml
│   └── params.yaml audience: ["dealers"]
├── employees
│   ├── config.toml
│   └── params.yaml. --> audience: ["employees"]

I tried as below but did not worked for me. I also tried audience:[dealers, employees]

---
title: "Demo for Editors"
linkTitle: "Demo for Editors"
weight: 10
description: >
  This page gives an overview of new features, reference for editors and prepared for demo usage
audience: dealers,employees
_build:
  list: true  
  render: true
---

Regards,

I think you mix up things here or miss one step between. The extra folders dealers and employees in the config directory are for two different systems (they override what is inside of _default and buiild the configuration for your dealers and employees environment. You start your server with hugo server -e dealers and it loads the dealers setup.

THEN you should have a layout somewhere that checks which environment the site is in and react according to the frontmatter. That step is missing.

@davidsneighbour
Maybe ı can not explain my issue.

So I can able to pass multiple params to related config params.What I mean, for instance for admin if I pass the employees as an another param then admin can also see the contents of employees,

But what I would like to achieve is, let’s say ı’ve a content as below in admin page and ı would like to display only this content for employees as well. Cause if I do this in params.yaml audience: ["employees","admin"] then employees will see all the pages in admin page.

Hope I can explain… I am looking a way to pass multiple params to front-end matter as a result

---
title: "Demo for Editors"
linkTitle: "Demo for Editors"
weight: 10
description: >
  This page gives an overview of new features, reference for editors and prepared for demo usage
audience: admin
---


config
├── dealers
│   ├── config.toml
│   └── params.yaml audience: ["dealers"]
├── employees
│   ├── config.toml
│   └── params.yaml. --> audience: ["employees"]
├── admin
│   ├── config.toml
│   └── params.yaml. --> audience: ["admin","employees"]

Regards,

Not sure to understand well what you want to achieve, but it seems that what you want is restricted access to some categories.

This can’t be achieved by hugo alone. You need to setup access on your server (or netlify identity).

@divinerites actually it can be as above but the only thing that I cant to this I can not restrict specific content for top level hierarchy.

What I mean, as you can see above I can restrict dealers’s contents for admin or employees audience as above.If I added audience:dealers to front matter it can be only visible when I run website via hugo server -e dealers

What I want to achieve, lets say I have an one page for admin audience but I need that content for employees.Instead copy/paste same content I would like to make it visible for employees as well.But employees should see only this page, not rest of the pages that I created for admins.

Thus ı need to pass something below but it did not work

---
title: "Demo for Editors"
linkTitle: "Demo for Editors"
weight: 10
description: >
  This page gives an overview of new features, reference for editors and prepared for demo usage
audience: admin, employees --> this is not working
---

OK. But hugo is not suited for production. Only for dev.
So if I’m not wrong : whatever you need for access, it will be thru some “access control” on the “production server/production CDN” side.

2 Likes