[![enter image description here][1]][1]
The page you linked to provides a simple skeleton toAMP docs start with a simple skeleton. I used {% extends "_layoutamp" %}
in our _amp
template so we need to make a ``_layoutamp.html" file to match inside Craft's templates folder.
{# _layoutamp.html #}
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>{{entry.title}}</title>
<link rel="canonical" href="{{entry.url}}" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "{{entry.title}}",
"datePublished": "{{entry.dateCreated.iso8601()}}",
"image": [
"logo.jpg"
]
}
</script>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s <style>body1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{opacityfrom{visibility:hidden}to{visibility:visible}}@-moz-keyframes 0-amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style>bodystyle><noscript><style amp-boilerplate>body{opacity-webkit-animation: 1none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
{% block content %}
{# brings in the content from the _amp.html content block #}
{% endblock %}
</body>
</html>
AMP requiresrecommends some metadata near the top, in the form of JSON. Easy enough to spit out the required fields in Twig.
#Anything else?#
Pretty much the rest is up to you. AMP is almost toopretty easy not to setup but you still need to use their custom tags.
Most notably, things like images and videos need to use custom tags like amp-img
and amp-video
, so the AMP runtime can intercept the loading of those assets and handle them.
Will be interesting to see how this affects page rank moving forward. Google confirmed it's not a ranking signal (yet) but that doesn't mean it won't be in the future.
[1]: https://i.sstatic.net/KRdUt.png