Streaming live at 10am (PST)

Add custom code in head in a specific page of articles

Hello Everybody,

I would like to add custom json code in the /head of an article page. Would it be possible ?

I have noticed that we can add custom code by clicking on “settings” for a CMS collection page but it will concern all my pages and I would like to do it only for one page of my collection page. I cannot use the embed element on that specific pageas it should be placed in the head section.

Thanks for your help

Here is my public share link: LINK
(how to access public share link)

Hello Louis,

If you have different json-code in function of the type your article,

  1. I suggest you to create a CMS collection with the name “json-code”, and put your custom code here.
  2. After, in your article settings CMS, link the reference JSON-CODE.
    3)And in your article template, add the field JSON-CODE in the head.

Otherwise if you have just on type of json code,

  1. Just create a new plain text in your article CMS settings with the name “json-code”
  2. In your article editors, and past your custom code in the “json-code” field
  3. And in your article template, add the field JSON-CODE in the head.
1 Like

Thanks @Bilal_Harouchi for your reply,

Yes it works (it is what I did before your reply) but actually I need to have this JSON for all my articles in the collection list. It’s not the case currently, it only concerns some. Do you know how I could to
-display it only when that field is completed
-if it’s empty, remove the code in the head


I just tried this on my site but when choosing my plain text field as an input for the headersection in the CMS template page, it doesnt get treated as code on my published text. That is, characters are being coded as text and not code and thus the script does not work. Do you have any workaround? (Iäve tried with rich text field and embedcode, but I cannot add rich text fields to the header section of the page template.)

1 Like

Did anyone find an answer to this? I also tried adding head section code through CMS text field, but it encodes the characters as text.

same here, any solution?