A unified solution for AMP HTML

I’m currently thinking of adapting AMP HTML to one of my projects.
As it is a news-site I would like to have 2 versions for the special type of News-Document nodes. I’m thinking about either having a subdomain m.example.com or somehow modifying the routing so that the articles have somethink like {newsurl}-m.html.
Than I need some kind of TS context switch to have all prototypes point to different template paths (AMP compatible HTML) and of course the page layout itself.
As I have currently no clue how I want to start this and would like to collect some ideas on that. Probably I could implement this as a package that can be used by everybody to extend their site with AMP HTML with a simple configuration saying which document nodes should be served as AMP and do a mobile detection using e.g. WURFL and redirect mobile devices to the AMP version of the document node (still having the canonical url pointing to the original version).

Sounds good, as I have no idea about AMP yet I guess I need to read up, currently I wouldn’t have any recommendations.

Hey Hans,

I think basically you could do the following:

  1. Switch to a different Entry Point when rendering a page e.g. based on a URL parameter. So do not render /page, but /amp for instance. This is possible using TypoScript along the lines of:
root.ampSwitch {
    condition = ${request.arguments.amp}
    renderPath = '/amp'
}
// add the request argument to caching
root.@cache.entryIdentifier.amp = ${request.arguments.amp}
  1. Define your custom Page Type, so instead of:
     page = Page {
           ... your definition here
     }
    

you do the following:
```
prototype(Namespace:MyCustomPage) < prototype(Page) {
your definition here
}
page = Namespace:MyCustomPage
amp = Namespace:MyCustomPage


3. Adjust the rendering inside `/amp`:

amp.prototype(Text).templatPath = '…'
amp.prototype(Image).templatPath = ‘…’


Everybody who would use the "library" would need to do step 2) (which is rather easy I think); while Step 1 and 3 could be done in the generic AMP package.

All the best,
Sebastian

It is an interesting topic to me. I am going to integrate my site to have AMP support. Are there any updates?