Forum Discussion
6 Replies
- vishwajeet_hol - You mean the ID of the article? if yes, it would be same as for the other topics.
More details here - https://community.lithium.com/t5/Developers-Knowledge-Base/FreeMarker-context-objects-and-directives/ta-p/9217
and
here, https://community.lithium.com/t5/Developers-Knowledge-Base/page-FreeMarker-context-object/ta-p/9331Sign in to react to this post I want the teaser image of blog article.
For this i am using this rest api call :
<#assign blog_article_teaser = restadmin("/messages/id/<blog_article_ID>/teaser?restapi.response_style=view").value />I used below context object for blog_article_ID, but its of no use. :
- ${page.context.message.id}
- ${env.context.message.id}
- ${message.id}
- ${message.uniqueId}
- ${page.context.message.uniqueId}
- ${env.context.message.uniqueId}
Let me know if you have any idea.
Thank you.
Regards,
Vishwajeet.
Sign in to react to this postHi,
Just for your information.
I have done that using freemrker.
<#assign pageurl=http.request.url/> <#assign pathparams=pageurl?split("/")/> <#assign blog_ID = pathparams[(pathparams?size)-1]/> <#assign blog_article_teaser = restadmin("/messages/id/${blog_ID}/teaser?restapi.response_style=view").value />Let me know if we can do the same using freemarker context object
Thank you.
Regards,
Vishwajeet
Sign in to react to this post- Nath8 years agoGuide
Hi,
You can't get current ID pageBlog with var env ?
the var ${env.context.message} return error (message is null) :(
Sign in to react to this post Are you trying to get the blog article id using context object? If yes, then you have to use the message.id. Here is the documentation
https://freemarker-docs-portal.lithium.com/refer/contextObjects#message
Sign in to react to this post- ttadej8 years agoAdvisor
"Teaser" refers to a text preview. You might be trying to get the "cover image".. in that case try this API v2 call
<#assign blogId = (page.context.message.uniqueId)! /> <#-- Then the v2 call is something like SELECT cover_image from messages WHERE id = '${blogId!}' -->Sign in to react to this post