Forum Discussion
8 Replies
- RickyS14 years agoLithium Alumni (Retired)
Hi woodag,
There isn't a pre-built widget available that'll do what you're asking. Just to make sure I understand correctly, you'd like to show a widget with recent board posts to show on your blogs pages and a recent blog articles widget to display on your discussion board pages?
If that's the case, your best bet is to create custom content via the Community Admin tool or custom components via Lithium studio that creates widgets as described above. You're limited to the number of custom content you can create (9 content areas total) but the custom content code can be node-specific - meaning, you can have different custom content code for different levels of your community. Custom components are built in Studio and are the same community-wide. This thread does a much better job of explaining the difference.
In your case, I would recommend going with Custom Component via Studio. If you're not already, you'll have to familiarize yourself with our Rest API documentation.
Latest Rest API Documents can be found in this TKB article. Studio documentation: Studio TKB. We recently put together a series of training videos on how to use Studio Advanced. If you'd like to view these training videos, please submit a case ticket requesting access to this valuable resource.
For each widget you build, you can specify which specific category or board you'd like to pull the most recent discussion topics or posts, and same for blogs, you can specify where you want to pull your latest articles or comments. You can also specify your Rest API calls to pull up content based on other criteria like "featured topic" - a designation you can add to content in your boards you'd like to highlight or "feature". This is only a backend setting and won't show anything on the community front-end if you mark a topic or blog article as featured. But this option gives you a little bit more editorial control over what content you'd like to display in the blog/board widgets you want to create.
Once you determine which Rest API calls you want to incorporate into your widget, you'll have to add the styling html and css code within the custom content code to format and present the XML data properly, consistent with your community styling.
Hope that helps, woodag!
RickyS
- KaelaC14 years agoLithium Alumni (Retired)
Here is a little example code for you. It will display the latest 3 blog article teasers from all blogs in the community
<#assign messages = rest("/topics/style/blog/recent?page_size=3").messages /> <div class="recent-articles-container"> <#list messages.message as message> <div class="recent-article-wrapper"> <div class="article-header"> <div class="article-subject"><a href="${message.@view_href}">${message.subject}</a></div> <div class="article-posted-by"> <span class="author">Posted By <#if message.author.login != "" && message.author.login != "Anonymous"><@component id="common.widget.user-name" user="conv:${message.author.login}" /></#if></span> </div> </div> <div class="article-teaser"> <#if message.teaser?length gt 0> ${message.teaser} <span class="read-more"><a href="${message.@view_href}">Read More</a></span> </#if> </div> </div> </#list> </div>
- woodag14 years agoGuide
KaelaC / RickyS:
Thank you for the help. I'm finally getting around to trying this.
I put the code into a custom component on my stage server. In the preview it appears it is pulling in the three most recent posts from the various blogs in our community. How to I get it to pull from one specific blog only?And then, how do I create another that pulls from a discussion board or group of boards in the same category?
- KaelaC14 years agoLithium Alumni (Retired)
To pull from one blog change the first line to
<#assign messages = rest("/blogs/id/[your blog id here]/threads/recent ?page_size=3").messages />
- woodag14 years agoGuide
hit a snag trying to do this. tech had me change it to
<#assign messages = rest("/blogs/id/[your_blog_id_here]/topics/style/blog/recent?page_size=3").messages />
also for anyone else reading this, the final steps in order to have this Content to show up with the proper styling of its title were:
go into Admin > Content > Custom Content
create a new Custom CONTENT with the title you want shown on the page, and that calls this Custom COMPONENT with the following tag
<@component id="[custom_component_id_here]"/>
go back to Studio > Page and put the Custom CONTENT into the appropriate page
go back to Admin at the Community or Board level, Display > Page Layouts and reassign as needed
once pushed to production you will need to repeat the admin steps on your live site
- sarahmolinari14 years agoContributorGood discussion, we just may implement this on our community soon as well.
- Inactive User13 years ago
Does anyone know if this has been added as a Lithium-included component?
- KaelaC13 years agoLithium Alumni (Retired)This isn't a Lithium core component (doesn't automatically show up in the component list) but you can add it in Studio as a custom component. Then you can add it to pages and such just like any other Lithium component.
Related Content
- 10 months ago
- 11 months ago
- 3 years ago
- 2 years ago
- 3 years ago