Individual Custom code for cms element

I have blog cms and I want to have custom code in the head for all the blogs, but the code is different for all the blog. If anyone have any solution for this.

Hi Hamza,

The common way to do this is not to put it in the head, but in the body using a Rich Text Block. You can position it at the top of your layout or at the bottom, depending on when and where you want it to load.

In your blog collection, put can create a separate rich text field e.g. “Code”, and then in that rich text, you only put Embed elements containing your item-specific custom code, CSS, JSON-LD, or whatever.

If you really need it in the head… you could build an injector based on the technique I’ve described above, which moves that code into the head after page load. Or, you could use a plaintext CMS field to store it, and embed it- but you’d have to HTML decode it using custom code somewhere.