Multiple single site based on one content file with conditional parts

#1

Hi!
I have the following scenario: I am writing a documentation for a product. The whole text is within one content file (markdown). This product now has different editions, so the documentation could slightly differ partially. One sentence / illustration here and there.
I want to have one content markdown file with conditional blocks, and I want to generate multiple single page from this one content file, displayed in the same site.
Could anyone give me help with this?

I already created a conditional shortcode which uses a params value. So if I set a specific parameter in the config file, I can generate different sites from one content with conditional blocks in the content markdown.
This is my conditional shortcode template:

{{ if (eq (trim (index .Site.Params (.Get 0)) " " | lower) (.Get 1)) | and (isset .Site.Params (.Get 0)) }}
    {{ .Inner  }}    
{{ end }}

Could be used like this:

{{% condtext edition a %}}
    Content only appearing, if config.toml  has edition = "a" in params.
{{% /condtext %}}

Thank you for your guidance and help!

#2

This was uncategorized, so Iā€™m not sure where it goes. Did you have a question? Is this a tip to others? If you need support, please read Requesting Help and use question marks. :slight_smile:

#3

Thanks! :blush:
I am asking for help, asking for direction, how to proceed with this.

Right now what I have figured out, is to use the translations feature to have different versions on one site, use the conditionals in the content file - this I shared in the OP, and symlink the content file to a translation content file. The paramters are given to the content file from the translations section in the site config.

1 Like