Add AMP support to our starter theme
See original GitHub issueAlthough Frontity supports AMP, our current start theme (mars-theme) doesn’t. We should fix that.
I think that we should add not only AMP for posts and pages, but for all the possible urls, as long as a /amp
is added at the end.
Instead of creating a new entry-point at /src/amp/
I’d rather use state.frontity.mode === "amp"
so it’s easier to understand for beginners.
This requires that we end our html2react
library first to be able to change the content HTML from WordPress for things like images and iframes, removing scripts and so on.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
How to Configure the AMP Plugin on Your Website?
Configure AMP Plugin · Template Mode – Transitional: Enable this option. It will create a non-AMP and AMP versions of your content. ·...
Read more >How to Properly Set Up WordPress AMP - The Complete Guide
1. Use the AMP for WordPress Plugin · 2. Install the AMP for WP – Accelerated Mobile Pages Plugin.
Read more >How to Properly Setup Google AMP on Your WordPress Site
First thing you need to do is install and activate the AMP plugin. For more details, see our step by step guide on...
Read more >Custom AMP Theme - WordPress.org
Hi, My theme requires the official amp plugin, previously I used functions to exclude the core WordPress scripts etc. But it is far...
Read more >What is AMP and how to use it - WordPress Theme FAQ - Meks
The best way to add AMP support on your WordPress powered website is to use AMP plugin developed by Automattic. When you enable...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Poliuk I think that would be a great end goal. I think the next step for me is to create a proof-of-concept.
Pantheon does not have Node support so I will look at doing WordPress on Pantheon and Frontity deployed elsewhere. We use Google Cloud Platform for our infrastructure so I would prefer to use their Cloud Functions.
I’ll start with things locally. Where I could use help from you is when it is time to deploy Frontity to GCP and “go live” with the proof of concept.
A doc similar to the deploy on Now for Google Cloud Functions would be helpful.
I can take what I learn and help with that Doc first. If things work then we can expand into adding Pantheon to your docs and Frontity to our docs.
@luisherranz thank you for the detailed reply.
I would love to use the same component to build the block for Gutenberg/the back-end and on the front-end. The issue now is that the WordPress REST API exposes the rendered HTML, not the block data. The block attributes aren’t always exposed to the server (link). I think ideally the REST API would serve up the block attributes (for example, the text and citation for a block quote) to be consumed by a front-end client.
I totally understand 😄 that there is much value in a way to convert HTML to React (AMP aside).
The WordPress AMP plugin already transforms the HTML to be AMP valid (images to AMP images, galleries block to AMP carousel, etc.). As that plugin evolves support for more blocks will continue. The idea of consuming the already processed AMP HTML appeals to me.
Your example of
return state.frontity.mode === "amp" ? <Content html={content.amp} /> : <Content html={content.rendered} />
seems much simpler to me than maintaining a transformer for block galleries to AMP carousel when the AMP plugin already provides it, though you may already have plans to make all components ofhtml2react
AMP aware, like the Image component is.Overall, Frontity looks great and I will explore it, especially as it continues to develop.
I am on the DevRel team at Pantheon and doing a proof of concept workflow for creating Frontity sites on Pantheon seems very interesting. Happy to collaborate there if it seems interesting to you as well.