From bf6aa689bedb9c1f607c843ebda091419144bfdd Mon Sep 17 00:00:00 2001 From: Jake Lee Kennedy Date: Wed, 21 Feb 2024 17:10:14 +0000 Subject: [PATCH 1/2] workaround for thirdPartyJSTracking --- src/routes/csr/[template]/+page.server.ts | 6 ++++++ src/templates/components/Fabric.svelte | 3 --- src/templates/csr/fabric-xl/{ad.json.disabled => ad.json} | 0 src/templates/csr/fabric-xl/index.html | 1 + src/templates/csr/fabric-xl/index.svelte | 2 -- src/templates/csr/fabric-xl/test.json | 2 +- src/templates/csr/fabric/{ad.json.disabled => ad.json} | 0 src/templates/csr/fabric/index.html | 1 + src/templates/csr/fabric/index.svelte | 2 -- src/templates/csr/fabric/test.json | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) rename src/templates/csr/fabric-xl/{ad.json.disabled => ad.json} (100%) create mode 100644 src/templates/csr/fabric-xl/index.html rename src/templates/csr/fabric/{ad.json.disabled => ad.json} (100%) create mode 100644 src/templates/csr/fabric/index.html diff --git a/src/routes/csr/[template]/+page.server.ts b/src/routes/csr/[template]/+page.server.ts index d6f770f8..628dcff9 100644 --- a/src/routes/csr/[template]/+page.server.ts +++ b/src/routes/csr/[template]/+page.server.ts @@ -18,6 +18,11 @@ interface Data { const github = 'https://github.com/guardian/commercial-templates/blob'; +const getSupplementalHTML = (template: string) => { + const path = `src/templates/csr/${template}/index.html`; + return existsSync(path) ? readFileSync(path, 'utf-8') : null; +}; + export const load: PageServerLoad = async ({ params }) => { const { template } = params; @@ -58,6 +63,7 @@ export const load: PageServerLoad = async ({ params }) => { const html = [ ``, `
`, + getSupplementalHTML(template) ?? '', ``, ].join('\n'); diff --git a/src/templates/components/Fabric.svelte b/src/templates/components/Fabric.svelte index bb18446b..8532acc3 100644 --- a/src/templates/components/Fabric.svelte +++ b/src/templates/components/Fabric.svelte @@ -7,7 +7,6 @@ export let TrackingPixel: string; export let ResearchPixel: string; export let ViewabilityPixel: string; - export let thirdPartyJSTracking: string; export let BackgroundScrollType: 'parallax' | 'none' | 'fixed'; export let BackgroundColour: string; export let BackgroundImage: string; @@ -100,8 +99,6 @@ {/if} -{@html thirdPartyJSTracking} -