2.0.28 • Published 4 years ago

gbhrdt-story-json-to-amp v2.0.28

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

story-json-to-amp

(forked from micnews)

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:

NameDescription
preview.publisherREQUIRED. The name of the story's publisher.
preview.publisherLogoSrcREQUIRED. The publisher's logo in square format (1x1 aspect ratio).
preview.posterPortraitSrcREQUIRED. The story poster in portrait format (3x4 aspect ratio).
preview.posterSquareSrcThe story poster in square format (1x1 aspect ratio).
preview.posterLandscapeSrcThe story poster in landscape format (4x3 aspect ratio).
customCssExtra CSS to append to AMP story document. This is useful for adding fonts or making AMP-specific customizations.
analyticsArray of AMP analytics objects
bookendConfigSrcBookend 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

2.0.28

4 years ago

2.0.26

4 years ago

2.0.27

4 years ago

2.0.25

4 years ago

2.0.24

4 years ago

2.0.23

4 years ago

2.0.22

4 years ago

2.0.21

4 years ago

2.0.20

4 years ago

2.0.19

4 years ago

2.0.18

4 years ago

2.0.17

4 years ago

2.0.16

4 years ago

2.0.15

4 years ago

2.0.14

4 years ago

2.0.13

4 years ago

2.0.12

4 years ago

2.0.11

4 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago