-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically append ?amp to URLs in Paired mode (AMP-to-AMP navigation) #1389
Comments
@jukefr Could you share a link where we can observe the behavior? |
This is normal behavior. Links in the page continue to point to their canonical versions. There has been some work to define an official way for AMP documents to link to other AMP documents instead of non-AMP documents. In the AMP project this is called “AMP-to-AMP navigation” and you can read about it here: ampproject/amphtml#12496. Nevertheless, it appears that this feature is only being developed in the context of AMP-to-AMP navigation within the AMP viewer and not for navigation on your own origin (see ampproject/amphtml#12981 (comment)). All this to say: at the moment if you want to retain navigation in AMP when linking to other pages on your site, the only solution at present is you add Nevertheless, I am not sure at present if this would have any negative impact on the SEO for the canonical URLs on your site. We should get confirmation from Google Search on whether this is a good suggestion. I expect it would be fine since the AMP documents still have the |
So far we've only been considering AMP-to-AMP navigation on the origin. What about an opt-in to AMP-to-AMP navigation on the AMP Cache? @pbakaus If AMP-to-AMP navigation is enabled, can links on pages served from the AMP Cache be rewritten to link to the AMP Cache URLs as opposed to the origin URLs? For example if I go to the XWP website on the AMP Cache at https://xwp-co.cdn.ampproject.org/c/s/xwp.co/ could the link to “Work” be rewritten from https://xwp.co/work/ (as it is served from the origin) to https://xwp-co.cdn.ampproject.org/c/s/xwp.co/work/ ? This would be vey cool as it would mean a site could more fully take advantage of the AMP Cache as a CDN. |
@cramforce to add thoughts on A2A (if there's anything to share). This would indeed be more a feature for the AMP Caches or AMP itself, vs. the WordPress plugin. |
I think we could keep the 2 discussions separate. Should AMP articles link to other AMP articles: Yes. Maybe add an option to turn it off if folks don't want it in some circumstance. AMP-to-AMP-navigation on the viewer side is something I continue to find interesting, but it'll only be for specific use cases long term. When web packaging ships URLs will be on the origin all the time. This just makes the first point (actually link to AMP) more important. |
I like the idea of supporting A2A linking in WordPress enabled by the plugin, with a flexible option to opt-in/out of it. |
I'd say that we should default to linking to the non-AMP version when serving classic templates, since this is the legacy behavior and because the classic templates are so limited. But going forward for sites that use the new paired mode we can then default to linking to other AMP pages from an AMP page since now there is much more parity. |
I've worked out a little AMP extension plugin to implement AMP-to-AMP linking: https://gist.github.com/westonruter/f9ee9ea717d52471bae092879e3d52b0 This plugin is mostly relevant for sites that are using paired AMP (paired/classic mode). It's mostly irrelevant for AMP-first sites (native mode), except that it implements “A2A linking” features as outlined on ampproject/amphtml#12496, namely the Also, per the plugin description:
It will be nice when/if the AMP viewers implement A2A linking as that would I hope mean that you could browse an entire site in AMP without ever leaving the AMP cache. Though again, this may not be relevant when when web packaging is widely deployed. |
Thinking more about this. I am not certain that we should provide AMP-to-AMP linking automatically in Transitional (paired) mode, because we cannot be certain the differences between the AMP and non-AMP versions would not have a negative effect on SEO. On the other hand, if we offer this as an opt-in feature, we could give the control to the user for making that decision. When opted in, the plugin would automate the outbound linking to AMP pages from AMP pages. |
Let's do this:
|
Testing instructions:
|
Verified in QA |
Hey again,
Wanted to say thanks for the awesome work you put into this project and that the v1 is looking better and better every day 👏
Now for my issue :
I want the entirety of my Wordpress to be available as AMP.
I have activated the plugin in Paired mode and started transitioning my templates with is_amp_endpoint()
The problem I am having is that any links that get rendered on an AMP page will point to the non-amp version of the page.
I have beta 2 and activated automatic stripping of non valid markup.
I have tested accessing said pages (the first one and the one that is linked) directly with
?amp
and all went well.I was planning on maybe checking the query parameters inside a hook and append ?amp to every link that gets rendered for that call.
I am pretty sure however that there might be a better way to do this.
I might also have a problem on my end or a bad understanding of how things work as I'd expect that this would be a feature that would be enabled by default for an AMP plugin. I tried searing in the Wiki and the Issues but could not find anything relating to this apart from trying to manually enable paired mode and setting a template folder in my
functions.php
but that did not help.If there is a more appropriate place to ask question like those so that I don't end up spamming the issues I'd be glad to hear about it !
Cheers
The text was updated successfully, but these errors were encountered: