Message Boards
getting tags of blogs in a blog widget template
Niels Dohms, modified 4 Years ago.
getting tags of blogs in a blog widget template
New Member Posts: 8 Join Date: 12/6/19 Recent Posts
I want to write a custom blog widget template. That template is used on a widget page to display the blogs as specified in the blog widget template. When i creat a new blog i can add tags, but as far as i am aware there is no method in the freemarker template to get the tags.
I know that if i were to create an asset publisher widget template i can use:
<#list entries as curEntry>
<#list curEntry.getTags() as curTags>
${curTags.name}
</#list>
</#list>
When i view the blogs attribute it seems that tags is not an attribute of blogs.I get the following list of attributes for blog entreis:statusDate, smallImageId, smallImage, trackbacks, coverImageURL, groupId, description, title, uuid, allowTrackbacks, conten,t entryId, lastPublishDate, createDate, statusByUserId, allowPingbacks, smallImageURL, finderCacheEnabled, urlTitle, smallImageFileEntryId, entityCacheEnabled, userName, userId, coverImageFileEntryId, companyId, coverImageCaption, subtitle, displayDate, modifiedDate, statusByUserName, mvccVersion, status
Is there a way to get the tags in a blog template?
Also before you ask, blog templates are made to display blogs, that is why i try to create a blog template and not a asset publisher template.
Thanks in advance
I know that if i were to create an asset publisher widget template i can use:
<#list entries as curEntry>
<#list curEntry.getTags() as curTags>
${curTags.name}
</#list>
</#list>
When i view the blogs attribute it seems that tags is not an attribute of blogs.I get the following list of attributes for blog entreis:statusDate, smallImageId, smallImage, trackbacks, coverImageURL, groupId, description, title, uuid, allowTrackbacks, conten,t entryId, lastPublishDate, createDate, statusByUserId, allowPingbacks, smallImageURL, finderCacheEnabled, urlTitle, smallImageFileEntryId, entityCacheEnabled, userName, userId, coverImageFileEntryId, companyId, coverImageCaption, subtitle, displayDate, modifiedDate, statusByUserName, mvccVersion, status
Is there a way to get the tags in a blog template?
Also before you ask, blog templates are made to display blogs, that is why i try to create a blog template and not a asset publisher template.
Thanks in advance
Mohammed Yasin, modified 4 Years ago.
RE: getting tags of blogs in a blog widget template
Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
Hi,
You can use Taglib for showing asset Tagsof selected asset entry in ftl
<@liferay_asset["asset-tags-summary"]
className=entry.getClassName()
classPK=entry.getClassPK()
portletURL=renderResponse.createRenderURL()
/>
You can use Taglib for showing asset Tagsof selected asset entry in ftl
<@liferay_asset["asset-tags-summary"]
className=entry.getClassName()
classPK=entry.getClassPK()
portletURL=renderResponse.createRenderURL()
/>
Niels Dohms, modified 4 Years ago.
RE: getting tags of blogs in a blog widget template
New Member Posts: 8 Join Date: 12/6/19 Recent Posts
Hi,
thanks for the replay and help. Your code did not work, but because of it, i found the following solution:
<#list entires as curBlogEntry>
<@liferay_ui["asset-tags-summary"]
className=curBlogEntry.getModelClassName()
classPK=curBlogEntry.getEntryId()
/>
</#list>
As you can see i had to change "liferay_asset" to "liferay_ui" that way i get all the tags associated with a blog entry.
thanks for the replay and help. Your code did not work, but because of it, i found the following solution:
<#list entires as curBlogEntry>
<@liferay_ui["asset-tags-summary"]
className=curBlogEntry.getModelClassName()
classPK=curBlogEntry.getEntryId()
/>
</#list>
As you can see i had to change "liferay_asset" to "liferay_ui" that way i get all the tags associated with a blog entry.