BlogArchives Macro
This is a Velocity macro, which isn't bundled with any XWiki product by default.
Macro contributed by Djebloun Sidali.
This macro cannot currently be downloaded separately.
Macro contributed by Djebloun Sidali.
This macro cannot currently be downloaded separately.
BlogArchives Macro
Viewing blogs published in the last x months#macro(BlogArchives $spaceApplicationBlog $viewerBlogsResulting $nbrMonths) #set($months = ["Foo","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"]) #set($results=$xwiki.search("select year(doc.creationDate), month(doc.creationDate), count(doc) from XWikiDocument doc, BaseObject as obj where obj.name=doc.fullName and doc.web='$spaceApplicationBlog' and obj.className='XWiki.ArticleClass' group by month(doc.creationDate) order by year(doc.creationDate) desc",$nbrMonths,0)) #set($docYear=".") #foreach ($row in $results) #foreach ($col in $row) #if ($velocityCount==1 && $docYear!=$col) #set($docYear=$col) * $docYear #elseif ($velocityCount==2) #set($docMonth=$col) #elseif ($velocityCount==3) #set($count=$col) #end #end ** <a href='$xwiki.getURL("$viewerBlogsResulting","view","curDate=${docMonth}-${docYear}")'>$months.get($docMonth) ($count)</a> #end #end
Usage
#BlogArchives($spaceApplicationBlog $viewerBlogsResulting $nbrMonths)
Parameters definition
| Name | Optional | Allowed values | Default value | Description |
|---|---|---|---|---|
| $spaceApplicationBlog | no | a string | none | a space application blog |
| $viewerBlogsResulting | no | a string | none | Viewer blogs resulting |
| $nbrMonths | no | a int | none | Number of months to display |
Example
#BlogArchives("Space_MySpace_Blog" "Space_MySpaceCode.displayByDate" 7)