Skip to content

Allow specifying amp-story bookend JSON inline #15826

@abhij89

Description

@abhij89

Hi,

What's the request?

You know how we load bookend from a json file placed somewhere on the server and not in the same file. Is it possible to have an option to have the bookend src from within the file.

<script id="amp-bookend" type="application/json">
{
  "share-providers": {
    "facebook": true,
    "twitter": true,
    "email": true
  },
  "related-articles": {
    "Articles": [
      {
        "title": "Pet adoption",
        "url": "https://en.wikipedia.org/wiki/Pet_adoption",
        "image": "assets/related-dogs.jpg"
      }    ]
  }
}
</script>

then do something like this: bookend-config-src="#amp-bookend"

Use case

For loading related posts based on current post category. So suppose in backend i have assigned categories to every stories, and now i want to load related stories from the category of the current story user is currently on. In current scenario i have to send a request with several parameters to load related posts, title, description, image etc which makes the process very lengthy. So instead of passing the request to some external process, if i could do all this in the same file where all the parameters are already available it will be lot easier and simple to generate bookend content.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions