How to show different set of pages per site using shared content folder?

Let’s assume I have 3 different websites that provide FAQ content for it’s users:

admins.mysite,com
managers.mysite,com
visitors.mysite,com

I want to have one main shared content subfolder, that hosts posts for FAQ that each site will have symlink to. Let’s assume this subfolder will be content/faq/

In this folder there will be pages, and depending on whether or not the page has tag “managers”, “admins”, “visitors” the page should be included in pages of the given site. For example, admins.mysite,com should only have pages/posts from content/faq/ that contain tag “admin”. This way some sites may have same content, and it would all come from same source. I dont want to have any pages that do not have the appropriate site tag to show anywhere on site or sitemap.

How can I accomplish this?

Note: I want to have a single content directory. Having three different versions of content/faq/ is not an option.

What are my options to do this?

P.S. Is there a way to set the draft value conditionally? “IF NOT HAS TAG “EXAMPLE” DRAFT = TRUE” type of deal?

not really a Hugo question, IF I understand it …

Make a directory FAQ outside of the websites, put the file in
Link content/faq to FAQ
Use site parameters to select what you need

@ju52 It’s not clear what you are suggesting. What do you mean by:

Use site parameters to select what you need

@interlockstock

No. You cannot conditionally serve different content by tag to 3 different websites that share the same content directory.

Hugo is a static site generator.

It seems that you need a database to achieve your goal and accordingly you would need a dynamic framework to serve pages on demand as you describe.

P.S. Unless of course someone can come up with some kind of a convoluted Bash script to populate the 3 different content directories from the original one, before site generation, but then again something like that falls outside the support scope of this forum.

I want to explain a little

you have

sites/admin/
sites/managers/
sites/visitors/

and create sites/faq - put here all faq markdown

under Linux

ln sites/admin/content/faq sites/faq

etc

So you have all faq in every site. ln has alternatives on Mac and Windows

Hugo does use content/faq as normal in all sites. Make your partials to select what you need.

I use this technology to create a linix config site, having assets/etc linked to /etc

Can I conditionally set a variable like draft in frontmatter based on some logic?

@ju52 That does not solve the problem, placing the same folder in several different sites is with a symbolic or hard link is not the issue. Problem is - how do I “filter” out posts for each site and make sure other posts are not available, including in sitemaps.

No. Template conditions and functions are not possible in the frontmatter of content files.

You can use these when you create the content files with Hugo Archetypes. An archetype can contain template functions.

However I still see no way how you could possibly use the Hugo CLI flags to choose which pages you would like published in each of the 3 projects (3 sites = 3 projects).