Edge Delivery Services how-tos · updated
head.html and 404.html in an Edge Delivery Services project
head.html is injected into every page's head on the server and combined with metadata from the content. aem.live says it should stay largely unchanged from the boilerplate. A 404.html in the repository root replaces the body of the default not-found response for any URL that matches neither content nor code.
Legitimate reasons to change head.html
- Remapping the project to a different base path when the site is served from a subfolder on your CDN.
- Supporting legacy browsers that need non-module scripts.
Adding Adobe Web SDK, Google Tag Manager or other third-party scripts to head.html is strongly advised against for performance, as are inline scripts and styles. Load martech in the delayed phase instead.
Custom 404
Put 404.html in the repository root. It is served for any URL without content or code, and can reuse your site's header, footer and styles so visitors can navigate on. Add a search box or links to top sections.
Preview and live URLs
Every branch gets a preview site at https://<branch>--<repo>--<owner>.aem.page/ and a live site at .aem.live. The combined <branch>--<repo>--<owner> must not exceed 63 characters, and none of the three may contain --, because they form a subdomain.
| File | Change it? | Why |
|---|---|---|
| head.html | Rarely | Every byte delays every page |
| 404.html | Yes | Better recovery for broken links |
| scripts/scripts.js | Yes | Auto blocking, loading phases |
How to do it
- Diff your head.html against the boilerplate and remove anything not needed.
- Move martech to the delayed phase.
- Create a root 404.html with navigation and search.
- Check branch names keep branch--repo--owner within 63 characters.
Related pages on this site
Questions
Can I add analytics to head.html?
aem.live strongly advises against it for performance; load analytics in the delayed phase.
Why does my branch preview URL not work?
Check that branch--repo--owner is 63 characters or fewer and that none of the names contain --.
Where does a custom 404 page go?
As 404.html in the root of the GitHub repository.
Sources
- aem.live: The Anatomy of a Project (checked 10 Nov 2026)
- aem.live: Web Performance, Keeping your Lighthouse Score 100 (checked 10 Nov 2026)
Facts about Adobe's platform are from the linked Adobe pages, checked 10 Nov 2026. Explanations and examples are ours unless marked as Adobe's.