Are AMP and non-AMP route possible?


#1

Hi all!

I’m wondering if anyone knows how I might best approach this.

I’m trying to develop a web application that renders both AMP and a non-AMP pages.

The distinction between the two will be handled by injecting the appropriate meta-data using the following: (I’m using ember-cli-head for this)

For non-AMP pages: <link rel="amphtml" href="https://www.example.com/url/to/amp/document.html">

For AMP pages: <link rel="canonical" href="https://www.example.com/url/to/full/document.html">

~ My problem is I’d like to do this in such a way where I don’t have to duplicate all of my routes.

I guess my question is, can I have all the routes render under domain.io/ and domain/amp/? – Essentially setting two rootURLs.


#2

You can do this:

// route.js
// ...
afterModel(post) {
  this.get('amp').set('canonicalUrl', post.get('url'));
  this.get('amp').set('title', post.get('title'));
}

See: https://github.com/bustlelabs/ember-cli-amp#capabilities