Enable Ghost CMS Built-in AMP Support for Blog Posts
Step-by-step guide to enable Ghost CMS's built-in AMP support, validate generated pages, customize the AMP template, handle common validation failures, and roll back if needed.
11 Jul 2025, 06:33 UTC

Desired Outcome
Publish Ghost blog posts with automatically generated AMP (Accelerated Mobile Pages) versions that validate against the AMP specification, serve from /amp/slug/ URLs, and include proper canonical links so search engines index both versions correctly.
Prerequisites
- Ghost version: 5.x or later (AMP support stabilized in 5.0).
- Admin access: Owner or Administrator role in Ghost Admin.
- Theme compatibility: Your active theme either includes an
amp.mustachetemplate or you accept the default minimal renderer. - Content audit: Identify posts that embed third-party widgets, custom JavaScript, or non-AMP video embeds—these will be stripped or cause validation warnings.
Enable AMP in Ghost Admin
- Sign in to Ghost Admin at
https://your-domain.com/ghost/. - Navigate to Settings → General → Publication.
- Scroll to the AMP section and toggle Enable AMP to On.
- Click Save settings at the bottom of the page.
Ghost immediately begins generating AMP versions for all published posts. Draft posts are not rendered until published.
Verify AMP Output
1. Spot-check a known post
Open a published post in your browser, then append /amp/ before the trailing slash. For example, if the canonical URL is https://example.com/welcome-to-ghost/, the AMP version loads at https://example.com/amp/welcome-to-ghost/.
Confirm:
- The page loads without layout shift.
- The HTML source contains
<html amp>or<html ⚡>. - A
<script async src="https://cdn.ampproject.org/v0.js">tag is present. - A canonical link points back to the standard URL:
<link rel="canonical" href="https://example.com/welcome-to-ghost/">.
2. Run the official AMP validator
Visit https://validator.ampproject.org/ and paste the AMP URL (e.g., https://example.com/amp/welcome-to-ghost/). The validator reports PASS/FAIL and lists any disallowed tags, missing mandatory attributes, or CSS size violations.
3. Check Ghost Admin for validation warnings
After publishing or updating a post, return to Posts in Ghost Admin. Posts with AMP validation issues display a yellow warning icon. Click the icon to see the specific error (e.g., "The tag 'script' is disallowed except in specific forms").
Customize the AMP Template (Optional)
If the default renderer strips too much styling, add an amp.mustache file to your theme root:
theme-folder/
├── default.hbs
├── post.hbs
├── amp.mustache <-- create this file
└── assets/
Minimal starter template:
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>{{{title}}}</title>
<link rel="canonical" href="{{url absolute="true"}}">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "BlogPosting", "headline": "{{{title}}}", "datePublished": "{{date published_at format="YYYY-MM-DD"}}", "author": { "@type": "Person", "name": "{{author.name}}" } }
</script>
<style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
{{#if amp_css}}<style amp-custom>{{{amp_css}}}</style>{{/if}}
</head>
<body>
<article>
<h1>{{{title}}}</h1>
{{{content}}}
</article>
</body>
</html>
Restart Ghost (ghost restart on the server) after adding the file. The {{amp_css}} helper injects your theme's compiled CSS (up to 75 KB). If you exceed the limit, the validator will fail—trim unused rules or use amp_css selectively.
Handle Common Validation Failures
| Issue | Cause | Fix |
|---|---|---|
Disallowed <script> tag | Theme or post HTML includes inline/third-party JS | Remove the script or replace with <amp-script> (requires separate JS file served with correct headers). |
| CSS exceeds 75 KB | Full theme CSS injected via {{amp_css}} | Create a minimal AMP stylesheet in amp.mustache using <style amp-custom>...</style> instead of the helper. |
| Embedded YouTube/Twitter fails | Standard iframes blocked | Use <amp-youtube>, <amp-twitter>, or Ghost's built-in AMP embed cards (available in the editor). |
Missing width/height on images | Images inserted via Markdown without dimensions | Ghost 5.x adds dimensions automatically for images uploaded to Ghost; for external images, ensure the Markdown includes  syntax. |
Monitor Performance Impact
AMP adds a small runtime script and forces a validation pass on each request. After enabling:
- Watch Time to First Byte (TTFB) in your server logs or APM tool for the
/amp/routes. - Compare Core Web Vitals (LCP, CLS) between canonical and AMP URLs in Search Console after 7–14 days.
- If TTFB degrades >50 ms consistently, consider caching the AMP HTML at your reverse proxy (Nginx/Cloudflare) with a short TTL (e.g., 5 minutes).
Disable AMP (Rollback)
If validation issues are unmanageable or performance regresses:
- Return to Settings → General → Publication.
- Toggle Enable AMP to Off.
- Save settings.
Ghost stops serving /amp/ routes immediately; existing AMP URLs return 404. Search engines will de-index AMP versions within a few crawl cycles. No database migration or content loss occurs.
Limitations & Gotchas
- AMP pages are generated only for posts. Pages, custom routes, and tag/author archives do not receive AMP versions.
- The
amp.mustachetemplate receives a subset of the standard post context—helpers like{{#get}}and{{#foreach}}are unavailable. - Ghost's built-in AMP does not support AMP Ads (
amp-ad) or AMP Analytics (amp-analytics) out of the box; you must inject them via the custom template. - Validation warnings in Admin only appear after a post is published or updated. Bulk-enabling AMP on an existing site requires re-saving each post to surface errors.
Quick Verification Checklist
- Toggle AMP on in Admin → Save.
- Open
/amp/your-latest-post/→ confirm<html amp>and runtime script. - Run URL through validator.ampproject.org → PASS.
- Check Admin for yellow warning icons on recent posts.
- (Optional) Add
amp.mustache→ restart Ghost → re-validate. - Monitor TTFB and Search Console for 2 weeks.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.