AMP HTML rendering for FT articles
-
Install the project dependencies,
make install
-
Fetch the environment variables for the app,
make .env
-
Generate a self-signed certificate:
make certificate
And add the certificate to your keychain:
security import cert.pem; security add-trusted-cert cert.pem
-
Run the app (no build is required in development mode),
make run
-
Open
https://local.ft.com:5050/content/<Content UUID>
https://app.lucidchart.com/invitations/accept/97a58184-f4b9-4ebf-b253-17f62799e460
To run the tests and linter locally, run npm test
.
- Google crawls FT.com and finds an article,
/content/ffffffff-ffff-ffff-ffff-ffffffffffff
- The article has a
<link rel="amphtml">
, with href pointing toamp.ft.com/content/ffffffff-ffff-ffff-ffff-ffffffffffff
- The Google crawler fetches the AMP URL, which hits this service
- The amp-page.js controller runs
- It fetches the content from Elastic Search using n-es-client
- It runs various transforms on the article data and body HTML
- It renders the transformed data into the template and responds with it
- The crawler validates the returned markup, and if it's valid AMP markup, stores it in the AMP cache
- When a mobile user searches for something that returns articles from FT with AMP versions, they're preloaded, and if the user taps on one of those results the AMP page is displayed immediately.
The main
branch deploys automatically to prod once the tests are green. Pull requests deploy to review apps, look out for the @username deployed to google-amp-prod-eu-pr-XXX
messages in the PR.
Use the Roll back to...
button on the Heroku activity tab or the heroku releases:rollback
command.