diff --git a/Configuration/Settings.Blog.yaml b/Configuration/Settings.Blog.yaml index 28341af..e18e35d 100644 --- a/Configuration/Settings.Blog.yaml +++ b/Configuration/Settings.Blog.yaml @@ -8,3 +8,6 @@ Shel: enabled: false twitterId: '' facebookId: '' + analytics: + tagManager: + ampContainerId: ~ diff --git a/README.md b/README.md index 56b9691..f63d1cd 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,18 @@ If you have additional custom content elements in a blog article like videos and you might need to provide processors to make them compatible with AMP. See the `replaceImgTags` image processor as example. +If you have installed the neos/googleanalytics package aside with shel/blog all analytics tags will be diabled to be AMP confirmative. +You could add a tag manager with + +```yaml +Shel: + Blog: + analytics: + tagManager: + ampContainerId: +``` +Please refer to [this page](https://support.google.com/tagmanager/answer/9205783?hl=en) for a detailed instruction how to set up a tagmanager container for amp + Please test the AMP version every time you add new features to your blog pages! Also be sure to check Google Search Console on your live site as it will inform you of errors. diff --git a/Resources/Private/Fusion/Layouts/AmpPage.fusion b/Resources/Private/Fusion/Layouts/AmpPage.fusion index 8174be1..cfeaf92 100644 --- a/Resources/Private/Fusion/Layouts/AmpPage.fusion +++ b/Resources/Private/Fusion/Layouts/AmpPage.fusion @@ -1,4 +1,23 @@ prototype(Shel.Blog:Layout.AmpPage) < prototype(Neos.Neos:Page) { + # Disable Neos.GoogleAnalytics and include amp tag manager -> https://support.google.com/tagmanager/answer/9205783?hl=en + googleTagManagerNoScript > + googleTracking > + googleTrackingScript = Neos.Fusion:Join { + main = afx` + + ` + @if.isset = ${Configuration.setting('Shel.Blog.analytics.tagManager.id')} + @position = 'before closingHeadTag' + } + googleTrackingCustomElement = Neos.Fusion:Join { + main = afx` + + ` + @if.isset = ${Configuration.setting('Shel.Blog.analytics.tagManager.id')} + @position = 'before closingBodyTag' + } + + # Additional scripts are not allowed with amp lastVisitedNodeScript >