Hi,
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"
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.
Hi @abhij89, we are laying the groundwork to allow this now. We are making a new <amp-story-bookend> tag which can specify a src attribute to achieve the current behavior. e.g.
<amp-story-bookend src="path/to/my/bookend.json"></amp-story-bookend>
However, this also opens the ability to directly embed a script tag, like the one you've mentioned:
<amp-story-bookend>
<script type="application/json">
/* bookend JSON goes here */
</script>
</amp-story-bookend>
This is not available yet, but we are working to release this in the near future.
/cc @Enriqe
Thanks @newmuis , looking forward to this. This will be an awesome upgrade.
Most helpful comment
Hi @abhij89, we are laying the groundwork to allow this now. We are making a new
<amp-story-bookend>tag which can specify asrcattribute to achieve the current behavior. e.g.However, this also opens the ability to directly embed a script tag, like the one you've mentioned:
This is not available yet, but we are working to release this in the near future.
/cc @Enriqe