story-json-to-amp
v2.0.1
Published
Convert story JSON to STAMP HTML.
Downloads
9
Readme
story-json-to-amp
Compile story-json documents into AMP stories.
Not all features of the story-json
format are supported at the moment. Open an issue if you need something that isn't supported yet. PRs are always welcome!
Usage
import story from './story.json';
import storyJsonToAmp from 'story-json-to-amp';
const ampHtml = storyJsonToAmp(story);
API
In addition to standard story-json
properties, a few special optional properties can be added to the document:
| Name | Description |
| ------ | ------------- |
| preview.publisher
| REQUIRED. The name of the story's publisher. |
| preview.publisherLogoSrc
| REQUIRED. The publisher's logo in square format (1x1 aspect ratio). |
| preview.posterPortraitSrc
| REQUIRED. The story poster in portrait format (3x4 aspect ratio). |
| preview.posterSquareSrc
| The story poster in square format (1x1 aspect ratio). |
| preview.posterLandscapeSrc
| The story poster in landscape format (4x3 aspect ratio). |
| customCss
| Extra CSS to append to AMP story document. This is useful for adding fonts or making AMP-specific customizations. |
| analytics
| Array of AMP analytics objects |
| bookendConfigSrc
| Bookend endpoint URL |
Example
Here's an AMP story generated by this module:
https://mic.com/stories/327/what-happens-in-your-brain-when-you-listen-to-music
License
MIT