Skip to content

Script and ad placeholders

Empty HTML hooks for the external scripts / ads team (epic AISD-230, worker half AISD-233). The Cloudflare Worker does not inject ads, prebid, or bytes from the cms_scripts S3 bucket in this release.

Source: shell mirrors under templates/templates/, src/layout/index.ts (renderLayout), test/shell-slots.test.ts.

Contract (data-slot)

Name Placement Intent
below_title Article shell, immediately after .article-meta ~100px ad slot under title/byline
after_section Article shell, after data-render="content_blocks" Sentinel for ~300px after-section ads (one marker in the shell; per-section cloning is out of scope)
custom_scripts_header Shell block scripts_header Empty head script mount
custom_scripts_body Shell block scripts_body Empty body script mount

Markup (exact attribute names — do not rename):

<div data-slot="below_title"></div>
<div data-slot="after_section"></div>
<div data-slot="custom_scripts_header"></div>
<div data-slot="custom_scripts_body"></div>

Placeholders must stay empty (no sample ads, no nested <script>).

How the worker emits them

Active shells (celebrity-v1, default) carry dedicated blocks:

<template data-block="scripts_header"><div data-slot="custom_scripts_header"></div></template>
<template data-block="scripts_body"><div data-slot="custom_scripts_body"></div></template>

renderLayout splices those blocks into every full page:

  1. scripts_header → end of <head> (after JSON-LD / styles)
  2. scripts_body → after footer, before the nav-toggle and load-more runtimes

Article-inline slots (below_title, after_section) come from the hydrated article shell block, not from renderLayout.

If a shell omits scripts_header / scripts_body, those mounts are simply absent (no error).

Out of scope (follow-up)

  • Reading cms_scripts or injecting JS into the slots
  • Consuming site setting scripts_split_config
  • Auto-cloning after_section between every rendered content section

Registry + upload APIs live in cms-api / hq (AISD-231 / AISD-232). See cms-api/docs/scripts-registry.md (portal: Scripts registry).

Operator: bump shell + upload

  1. Edit the mirror under templates/templates/<slug>/<old-version>/shell.html (or produce sha256(shell)[:12] as the new version directory).
  2. Upload on stage via cms-api admin:
# celebrity-v1 id=1, default id=-1 (stage today)
curl -X POST "http://cms-api-stg.skyneto.com/admin/v1/templates/1/file" \
  -H "Authorization: Bearer $CMS_ADMIN_TOKEN" \
  -F "file=@templates/templates/celebrity-v1/<version>/shell.html;type=text/html" \
  -F "version=<version>"
  1. Re-sync git mirrors per templates/README.md in the cms-cf-worker repo.
  2. Purge + redeploy if settings/HTML must refresh everywhere — see Caching → propagation recipe.

Verify

View-source on a plain article URL (no ?query):

  • All four data-slot="…" names present where the shell defines them
  • Slot inner HTML empty; no new <script> from this ticket
  • Health / sample article still 200