Expand my Community achievements bar.

Join Adobe Journey Optimizer product experts for a live Ask Me Anything on October 15th at 8 AM PT about Expanding Your Mobile Reach with RCS & WhatsApp in AJO!

Content Fragment Moves from <head> to <body> After Saving in AJO Content Template

Avatar

Level 9

I’m trying to keep the entire <head> section within a Content Fragment, so I created a dedicated CF and included it in the content template. However, after saving and reopening, the CF is automatically moved from the <head> tag to the <body> tag.

Before save,

<!DOCTYPE html>
<html data-qb-installed="true">
   <head>
      <meta charset="utf-8" />
      {{fragment id='ajo:ce84ac85-7f5b-4385-84cf-f3c850da8140' mode='inline'}}
      <header></header>
      <div>test</div>
   </body>
</html>

 When I reopen the same,

<!DOCTYPE html>
<html data-qb-installed="true">
   <head>
      <meta charset="utf-8" />
   </head>
   <body class="is-html-mode" contenteditable="true">
      {{fragment id='ajo:ce84ac85-7f5b-4385-84cf-f3c850da8140' mode='inline'}}
      <header></header>
      <div>test</div>
   </body>
</html>

 

The inserted Content Fragment is being moved from the <head> tag to the <body> tag after saving. Is it not possible to insert a Content Fragment within the <head> section

 

2 Replies

Avatar

Community Advisor

@Mario248 Yes. 

  • It's not possible to use Content Fragments within the <head> tag of an email. This restriction is by design to separate the content and metadata within email templates.
  • Intended Purpose of Content Fragments: Content Fragments are specifically engineered for the insertion of body content or editable regions within the visible part of an email. They are meant to hold elements like text blocks, images, buttons, product listings, or personalized greetings—all components that a profile will directly see and interact with.
  • You may know the purpose of the <head> Tag: In standard HTML email structure, the <head> tag is reserved for example metadata and scripts that is not directly displayed to the user. This includes elements like Meta tags: Provides information about the email, such as character set, viewport settings, and sometimes tracking pixels.
    Scripts (though generally discouraged in email for compatibility reasons): Client-side scripts.
  • Rendering and Compatibility Issues: Placing content fragments, which are processed by AJO to inject specific content, into the <head> tag can lead to:
    • Broken Email Layouts: The email client might not interpret the content correctly, resulting in a distorted or unstyled email.
    • Failed Content Personalization: The dynamic content might not render at all, or fall back to default values, defeating the purpose of using fragments.
    • Validation Errors: The email designer or email sending services might flag the email as invalid, preventing it from being sent.
  • If you observe the structure of the AJO email editor's navigation tree and the right-side panel, you'll notice a clear starting point in the body section. This visual representation reinforces that all editable content, including that which utilizes Content Fragments, is intended to reside within the <body> of the email. There is no explicit interface or mechanism provided for inserting fragments directly into the <head> section.
Thanks, Sathees

Avatar

Level 9

 

 Thank you for the detailed response.

 

The reason I created a Content Fragment was to include custom meta tags within the <head> section, which also contains CSS references. My goal is to keep all CSS and meta details in a separate Content Fragment so that they can be managed easily without modifying the actual body content.

 

However, I’m wondering if this approach aligns with best practices. Is it recommended to maintain CSS in a separate file and reference it instead? If using a Content Fragment isn’t the right approach, where is the best place to maintain and include CSS within a Content Template? What’s the recommended best practice for managing CSS in this context?