Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: architecture
templatesheadgatingduplication
Include third-party script bundles through one partial so gating happens once
When several head templates include the same set of ad/tracking partials, extract one partial with the conditional inside it; duplicated includes mean duplicated gates and a new script can be added ungated.
PR: hegnar-web#4698 FCK-3550 Drive ad suppression from the article flagCreated: Sep 7, 2026
Bad example
Old codets
| 1 | {# in 5 head templates #} |
| 2 | {% if not adFree %}{% include 'livewrapped.njk' %}{% include 'gpt.njk' %}{% include 'adnami.njk' %}{% endif %} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | {# ad-tech.njk #} |
| 2 | {% if not res.locals.adFree %}{% include 'livewrapped.njk' %}{% include 'gpt.njk' %}{% include 'adnami.njk' %}{% endif %} |
| 3 | {# elsewhere #} |
| 4 | {% include 'common/ad-tech.njk' %} |
Explanation (EN)
Objašnjenje (HR)