Custom Head Code per Item Joomla Plugin

This plugin lets you inject HTML into the page on a per-item basis: Article, Menu Item, Category, and Tag. Editors paste head-safe tags directly in the item form; the plugin outputs them on the matching front‑end page.


Key Features:

🧩

Per-item head code

Add meta, link, script, style, and JSON-LD directly in a Custom.

πŸ₯‡

Merge policy: Only first wins

Use the first non-empty source based on your order.

βž•

Merge policy: Append all

Concatenate all available sources in order.

🧭

Merge policy: Override

Same as Append, but strictly follows your custom CSV order.

πŸ“œ

Custom priority (CSV)

Set the exact order to evaluate/append: article, menu, category, tags.

πŸ”˜

Per-item toggle

Enable on this item (switch) to turn injection on/off without deleting content.

πŸ›‘οΈ

Auto CSP nonce

Automatically adds nonce="…" to inline <script> (incl. JSON-LD) when your site provides a CSP nonce.

βœ‚οΈ

Minify output

Trims whitespace before output for cleaner HTML.

🌐

Apply on

Choose where the plugin runs β€” Site / Administrator / Both.

πŸ”—

Context-aware

An article page can combine Article + active Menu + its Category + its Tag(s), depending on your policy.

βœ…

Compatibility

Joomla 4 & 5; no template overrides required.

🌍

Multilingual & complex menus

Data lives with the item, so language trees don’t clash.

πŸ”“

No lock-in

Uninstalling stops rendering but keeps your data in item fields.

πŸ“

Editor-friendly

No coding in templates; editors work where they already edit content.


Frequently Asked Questions

1) Where do I find the field?
In the Edit screen of an Article/Menu/Category/Tag, open the Custom Head Code tab.
2) What tags are allowed?
Head-safe tags only: <meta>, <link>, <script>, <style>, plus JSON-LD <script type="application/ld+json">...</script>. Avoid body tags like <div>.
3) How do I prevent duplicate canonicals/OG tags?
Set Merge policy = Only first wins and choose an order (e.g. article, menu, category, tags) so only one source is used.
4) What's the difference between Append all and Override?
Both append. Override always enforces your CSV order; Append all uses the configured order but may fall back to defaults.
5) How does Auto CSP nonce work?
If your template/site provides a CSP nonce via Joomla's Document API, the plugin automatically injects nonce="..." into any inline <script> that lacks one (including JSON-LD), preventing CSP blocks.
6) Can I disable it for a specific item without losing the code?
Yes. Flip Enable on this item to Off; the content stays saved but won't render.
7) What’s the default source order?
article, menu, category, tags. You can change it via Override order (CSV).
8) What if an article has multiple tags with code?
The tags source aggregates code from all related tags. Avoid placing single-instance tags (like canonical) in multiple tags.
9) Can it run in the backend?
Yes if you set Apply on = Administrator (or Both). Most sites only need Site.
10) Does caching affect it?
The code is injected into HTML. With page cache/CDN, clear cache after changes to see updates.
11) How does it behave in multilingual sites?
Each language's Article/Menu has its own code. The plugin doesn't translate content; add code per translation.
12) Will I lose data if I uninstall the plugin?
No. Your code remains stored in the item fields; it simply stops rendering in <head>.