Forum Discussion
Tim_h
9 years agoBoss
Hey bcmacdonald there are calls to get the teaser and blog body.
Api V1 in a custom component on the article page like this:
<#assign message = restadmin("/messages/id/" + page.context.thread.topicMessage.uniqueId).message />
From there the teaser field is "message.teaser"
But there's no "image" field.
We've got a predefined format for the teaser that our team follows.
Based on that we're parsing through the teaser to find the start and end of the specific image we want.
A function reads in the "message.teaser" and marks the location of the "<img>" and "</>" tags. we then cut the string down to that and use it to pull the image out of the teaser.
If you have an image in the post body you could do the same. But you'd need to make sure your code allows for other tags that could appear before the image.
Tim
Related Content
- 9 months ago
- 2 years ago
- 10 months ago