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?
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.
@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).