Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #751 from B77Mills/addHtmlInjectionSupport
Browse files Browse the repository at this point in the history
Add ability to pass html strings into body injection
  • Loading branch information
brandonbk authored Jul 21, 2023
2 parents a13e526 + 64b5a8f commit 5b070c3
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import GAMDefineDisplayAd from "@parameter1/base-cms-marko-web-theme-monorail/co
$ const { global: $global } = out;
$ const { GAM } = $global;
$ const { content, modifiers } = input;
$ const htmlInjections = getAsArray(input, "htmlInjections");
$ const preventHTMLInjection = getAsArray(content, "labels").some( l => ["Sponsored", "Product Spotlight"].indexOf(l) >= 0) || input.preventHTMLInjection;
$ const blockName = defaultValue(input.blockName, 'page-contents');
$ const aliases = getAsArray(input, 'aliases');
Expand Down Expand Up @@ -76,6 +77,17 @@ $ const gamAdInjection = (GAM) ? [
lazyload-first-image=input.lazyloadFirstImage
/>
<if(!preventHTMLInjection)>
<if(htmlInjections.length)>
<for|htmlInjection| of=input.htmlInjections>
$ const { at, html } = htmlInjection;
<if (at && html)>
<@inject
at=at
html=html
/>
</if>
</for>
</if>
<for|adInjection| of=gamAdInjection>
$ const { counts, name, modifiers } = adInjection;
<if(adInjection.counts.length)>
Expand Down

0 comments on commit 5b070c3

Please sign in to comment.