Forum Discussion
Hi
We're trying to do almost the same... but i was wondering if there is an rest api method to retreive images from the blog teaser. There is an api call for the images contained in a blog message (example: http://community.lithium.com/restapi/vc/messages/id/128039/images ), but i can't found the teaser's images.
In the example you provide, we need to manually parse the teaser string, which is quite tedious and having it in a rest call would simplify the customisation on a blog page...
regards
JC
Hi jc758
The images are normally included as a part of the teaser body. Therefore it's not possible to expose a rest call, simply because the teaser can really be anything - it's a text field that the user can populate with arbitrary HTML markup and it's not safe to assume that a teaser image will always be present in your code.
A potential improvement would be to include the image parsing logic in a Macro - so that you can define it once in the Endpoints section in Studio and maintain it in one place, then simply use the macro on the teaser content in your components which would greatly clean up your logic.
Hope this helps,