Introduction
Header & Footer Code (emdash-header-footer-code) is a native EmDash plugin. It lets site
admins add code snippets to public pages from the admin UI. Typical snippets are analytics tags,
search engine verification tags, chat widgets and small bits of CSS or JavaScript. You don’t need to
edit your theme or redeploy to add or change one.
How it works
Section titled “How it works”- You add snippets in the admin at Header & Footer Code
(
/_emdash/admin/plugins/header-footer-code/snippets). - On every public page request, EmDash calls the plugin’s
page:fragmentshook. - The plugin picks the enabled snippets that match the page’s path, page kind and locale, and sorts them by priority.
- EmDash renders each snippet where your layout puts
<EmDashHead />,<EmDashBodyStart />or<EmDashBodyEnd />.
Nothing is ever output on /_emdash/ admin paths.
Capability
Section titled “Capability”The plugin declares one capability, hooks.page-fragments:register. It is the only way to add
scripts or HTML to public pages, and EmDash won’t register the hook without it. The plugin requests
no other capability.
Requirements
Section titled “Requirements”emdash^1.0.1- React 18 or 19 and
@cloudflare/kumo^2.6.0 (peer dependencies used by the admin page; an EmDash site already has them) - A layout that renders the three EmDash page components (see Theme setup)