Intent to Implement: next page element
Background
There are several complementary navigation methods in existence. Some are simple to implement on the web (e.g. links) and others are common in apps but difficult to implement well on the web e.g. swiping.
AMP currently does support limited swiping - in the google example, the results are rendered into a horizontal scrolling container and you can swipe smoothly between stories. However there is no way for amp to allow swiping for navigation under control of the publisher.
If continuous scrolling/swiping up was trivial to implement in AMP, publishers wouldn't spend a long time making a shaky implementation themselves. Allowing this would also have the positive side effect of forcing publishers to clean up the bottom of the page and not serve big footers.
A standard implementation in AMP should provide a standard and excellent experience on all platforms, so users will trust its behaviour.
Overview
The new element would allow a defined amp page to be lazily rendered at the bottom of the previous one, and allow the user to swipe into it.
Usage
<amp-next-page href='/news/2015/10/16/interesting-another-article' ></amp-next-page>
Behaviour
The new element will lazy load another amp page and render it underneath. Once the page fills half the viewport, the URL bar will change and be added to the history. If a user navigates away, the viewport position is saved, and if the user comes back it will only render the correct article and scroll to the right place.
Variations
- the above example would treat the chain as a linked list. Perhaps it would make sense to have a list in the first element rather than just one, and only use the articles in that list. Otherwise it would be easy to get into a loop.
<amp-next-page>
<page href='/news/2015/10/16/interesting-another-article' ></page>
<page href='/news/2015/10/16/interesting-article-again' ></page>
</amp-next-page>
Thanks so much!
We were hoping to avoid having swiping both as a thing inside the article and on the viewer.
Any chance this could essentially be two link tag that indicate to the viewer what the preferred articles to swipe to are? Like:
<link rel="next-page" href="/news/2015/10/16/interesting-another-article">
<link rel=previous-page" href="/news/2015/10/16/interesting-article-again">
And then the AMP file would push that to its viewer when the file loads?
How would this work when the viewer and the amp page have different concepts of what the next/previous article should be?
I think that basically the viewer would win. CC @rudygalfi
Yeah, I think one of the goals of the format is portability, so the AMP file should expect to be rendered in any context where a horizontal or vertical swipe could conflict.
I like @cramforce's suggestion of using link tags as hints on previous page or next page to the viewer.
I also think this proposal needs to consider dynamic determination of previous/next like what's being discussed in #657. I think that would be useful, but perhaps in the typical case the previous and next articles can be statically determined and won't need to change much.
I think we have to support link next/prev since that's a standard thing. But one thing that's missing with these tags is where this document is in the collection of related documents. E.g. if we wanted to say "this is 3rd document out of 10". Also, this makes it a bit harder to prerender more than one or two documents at a time.
Rather than create new rel values like next-page and prev-page, please consider using the existing rel values next and prev: this use-case is exactly what they're intended for.
And again, remember that rel values can be space-separated so rel="next prefetch" is also an option (as is rel="next prerender").
I definitely think that a simple link element (or a element) is preferable to creating a new custom element to do the same thing.
Yeah, I'm pretty sure rel=next/prev is what that post meant. On Oct 17, 2015 4:54 PM, "Jeremy Keith" [email protected] wrote:
Rather than create new rel values like next-page and prev-page, please consider using the existing rel values next and prev: this use-case is exactly what they're intended for.
And again, remember that rel values can be space-separated so rel="next prefetch" is also an option (as is rel="next prerender").
I definitely think that a simple link element (or a element) is preferable to creating a new custom element to do the same thing.
— Reply to this email directly or view it on GitHub https://github.com/ampproject/amphtml/issues/655#issuecomment-148961670.
You received this message because you are subscribed to the Google Groups "amphtml-eng-github" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/amphtml-eng-github/ampproject/amphtml/issues/655/148961670%40github.com https://groups.google.com/a/google.com/d/msgid/amphtml-eng-github/ampproject/amphtml/issues/655/148961670%40github.com?utm_medium=email&utm_source=footer .
You received this message because you are subscribed to the Google Groups "amphtml-eng" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/amphtml-eng/ampproject/amphtml/issues/655/148961670%40github.com https://groups.google.com/a/google.com/d/msgid/amphtml-eng/ampproject/amphtml/issues/655/148961670%40github.com?utm_medium=email&utm_source=footer .
I think that rather than swiping to the next page, an infinite scroll would be more effective. The slightly revised overview could be:
The new element would allow a defined amp page to be lazily rendered at the bottom of the page, and allow the user to keep scrolling down and read new content.
Yes as @NataliaLKB said, the feature we had in mind was continuous scrolling, but I was trying to describe it in a more abstract way just in case people wanted to implement it another way in different contexts.
Perhaps the component in the amp runtime (without viewer) would be just a thing to use the rel next/prev to continuously scroll, but if it's running in a viewer that uses vertical swiping itself it can just use them as a hint.
Make sure that this, or similar, works:
<amp-next-page href="?amp=y&page=2"></amp-next-page>
If you're going to do infinite scrolling, I'd need some kind of marker container element to separate the headers/UI from the content.
+1 for this.
just for the record, I don't intend to implement this, but of course someone else could pick this up if they want
Does anyone on the AMP team have an idea on LOE of this? I was thinking about taking a stab at it.
Not 100% sure what LOE means :)
I think doing this as a document feature should be reasonably straight forward (although certainly not a small feature). It mostly depends on how much the documents cooperate. One facility that didn't exist when this was last discussed is AMP's shadow DOM support that would solve the style isolation issues between documents.
Level of effort. What do you mean a document feature @cramforce?
@pdufour Hey Paul. We're working on a project with a pretty big use case for this. Would be good to have a hangout as we've has some initial ideas about this
related: #9423
Infinite scroll is a big deal for us. One key feature we need is the ability to change what the next page is before loading it; in other words, we need to be able to hit the server to ask for the next page.
Thanks for the feedback, @sethlivingston — do you have any constraints on when this server call would need to be made, or if it could get a batch of pages, rather than just the one "next" page?
The longer we can put off the "decision," the better. Honestly the batch doesn't bring a lot of value for us, because our pages are lightweight enough to where we could just load a batch of pages immediately without any additional support from AMP.
The goal is to combine this feature request with https://github.com/ampproject/amphtml/issues/1296. Mmmmm, delicious:
- Visitor blows right through the first article in a scroll
- ...So we just load the next most recent article
- Visitor is more engaged on the second article
- ...So we load the next most recent article with tags matching that second article
- ...and so on