Does someone know how to activate AMP for home page?
If you add amp.hbs it is only for a post page.
Thanks
Hey @shystruk, you can do this by creating a new /amp/
route in your routes.yaml
file like so:
routes:
/amp/:
template: amp-home.hbs
data: page.home
After uploading this addition to your routes file via the Labs view in Ghost admin you can then create a new amp-home.hbs
template based on the default amp template in Ghost. Here’s some helpful links:
https://ghost.org/docs/api/v3/handlebars-themes/google-amp/
Hope this helps!
Thank you! It works.
@DavidDarnes What about pages? Can we add amp there too? E.g. tag/examle/amp
Can I ask what you’re trying to achieve? AMP is designed for articles and long form content, not really for all page types. I’m not saying it’s not possible in Ghost, I’m just wondering what sort of site structure you’re building and how that will fit into these AMP powered pages
Yes, AMP is for articles and form content.
One thing that confuse me is a site (blog) navigation. Once a user opens AMP article and then go home, page or another article it won’t be opened in AMP
Looks not good
Sounds like you want your entire site in AMP no? At some point you’ll want your readers to navigate from your AMP articles to your main site. AMP is fast loading but is limited. However if you do want to go all in with AMP then maybe you should consider using the Ghost Content API with AMP as a framework?
Yes, the entire site in AMP. Definitely should use Content API for that.
@DavidDarnes Do you know how I can add AMP version for a tag page e.g. tag/example/amp
?
I would recommend using Channels for a tags page for AMP. Here’s an example:
routes:
/tag/general/amp/:
controller: channel
template: amp-tag
filter: tag:general
Hope this helps!
That works. Thanks.
Seems like I should do that for each tag, correct?
That’s right