Guillaume Lerouge wrote:
Hi Daniel,
On Fri, Dec 18, 2009 at 6:16 PM, Daniel Johansson <[email protected]>wrote:
I'd like to customize the dashboard and add News category items from the blog. I have tried some examples but none of them seem to work. In the manuals there are mentions of macros in the blog but I can't seem to find any reference. What's the easiest way to include blog content in pages outside the blog? I'm using Xwiki 2.04.
You can try adding this somewhere in Main.Dashboard :
{{velocity}} #set($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.name<>'Blog.BlogPostClassTemplate' and doc.web='Blog' order by doc.creationDate desc")
#foreach($item in $xwiki.searchDocuments($sql,5,0)) #set($bdoc = $xwiki.getDocument($item)) #set($post = $bdoc.getObject("Blog.BlogPostClass")) #set($author = $bdoc.creator) #set($pos = $author.indexOf(":") + 1) #set($date = $xwiki.formatDate($bdoc.creationDate,"yyyy/MM/dd")) <div class="blogPanelAvatar">#useravatar($author.substring($pos))</div> * *[$bdoc.getValue('title', $post)>$item]* by [$author] on $date #end {{/velocity}}
It will list the 5 last articles from your wiki's blog.
Guillaume
Daniel _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Guillaume Lerouge Product Manager - XWiki SAS Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Thanks Guillaume, For some reason that script does not pull in my posts to the News category, which is what I was interested in. I was envisioning something just like this dashboard: http://www.xwiki.org/xwiki/bin/view/Main/News with recent news and recent changes. -- View this message in context: http://n2.nabble.com/Blog-category-in-Dashboard-tp4187409p4189810.html Sent from the XWiki- Users mailing list archive at Nabble.com.