Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

theme: support conditional content #876

Open
McShelby opened this issue Jul 11, 2024 · 0 comments
Open

theme: support conditional content #876

McShelby opened this issue Jul 11, 2024 · 0 comments
Labels
feature New feature or request

Comments

@McShelby
Copy link
Owner

McShelby commented Jul 11, 2024

There are use cases where the content of a site should be filtered on built to remove certain content a user should not see.

For example, a product documentation contains every feature in its Markdown files, but for a certain customer only a few of them are installed. The generated project should only contain documentation for the available features.

Implementationwise this will be implemented in a new shortcode that is flagged with a feature array in its parameter, similar to tags in frontmatter. If at least one of this feature flags is activated in the params of the config.yaml, the content will be put in the resulting page.

There also may be cases where a whole page is dedicated to a certain feature. If the feature is not available, in a best case scenario, the page isn't created. This probably can't be implemented with the current Hugo features, but we may could leverage the hidden feature of the theme to at least create an empty page that doesn't appear in any indices (search, tags, rss, etc).

See:
https://discourse.gohugo.io/t/ignore-content-when-publishing/13008/4
https://discourse.gohugo.io/t/render-some-pages-only-in-non-production/44306/5
https://discourse.gohugo.io/t/cli-filter-content-for-different-target-audiences/15439
https://discourse.gohugo.io/t/omitting-content/26437

@McShelby McShelby added the feature New feature or request label Jul 11, 2024
@McShelby McShelby self-assigned this Jul 11, 2024
@McShelby McShelby removed their assignment Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant