How to Set Blog (viewrecentblogposts.action) page as home page of a Space?
Asked by Tsol:

Hi everybody,

i'm using a space just for blog posting. I would like to set as Home Page of the space the page that i see when i click on browse and then Blog (viewrecentblogposts.action).

At the moment i'm using the blog post macro in the unique page of the space but i prefer how the (viewrecentblogposts.action) page looks, because it has categories of blog posts by month etc.

Any idea?

Thanks,

Kostas


Answers:
author: Andrew Frayling
body: Hi Kostas,

I'm not aware of a way of setting the home page of a space to viewrecentblogposts.action directly, but what you could do is:

1. Create a dummy page  
2. Set that as the space home page via Browse -\> Space Admin -\> Home page  
3. Use the [Redirection Plugin](https://plugins.atlassian.com/plugins/net.customware.confluence.plugin.redirection) to insert a {redirect} macro on the dummy page pointing to viewrecentblogposts.action

Hope that helps?

Andrew.

comments: author: Tsol
body: Hi Andrew,

the solution with the redirection plugin works fine. The problem is that i would like to have the viewrecentblogposts.action without all the tabs on the top of the screen. Basically my problem is that i don't have macros for the blog posts like search by month, search only blog posts etc. This functionalities are in the viewrecentblogposts.action page. Maybe i should check the viewrecentblogposts.action source.

Thanks a lot

Kostas


author: Andrew Frayling
body: Hi Kostas,

You can get close to the viewrecentblogposts.action page by creating a page that is 2 columns (60% and 40% width) with the blog-posts macro in the left hand 60% column and in the right hand 40% column a couple of instances of the recently-update macro showing updates for the last 31 days (one restricted to blog posts, one restricted to comments) with the search macro restricted to blogposts and possible the popular-labels macro.

I've knocked something up that does that, but it's hard to share now you can't copy and paste wiki markup in 4+. Does the above make sense?

Andrew.


author: Tsol
body: All right,

i think i got it. I'll try it.

Thank you Andrew

Kostas


author: Tsol
body: Hi Andrew,

i have followed the instructions from your blog (good work!) and it works fine.

Do you have any idea how to categorize the posts per month?

Thanx in advance

Kostas


author: Andrew Frayling
body: Hi Kostas,

Thanks for checking out the blog. Do you mean only displaying blog posts from the last month that have a particular label? You could do that with the "Restrict to these Labels" parameter documented at <http://confluence.atlassian.com/display/DOC/Blog+Posts+Macro#BlogPostsMacro-Parameters>

Or do you want something fancier?

Andrew.


author: Tsol
body: Hi again Andrew,

No i didn't mean to categorize blogposts that have a particular label. Basically i'm trying to see how blogposts are categorized per month in viewrecentblogposts.action page. In viewrecentblogposts.action page, in the right column blogs are categorized per month. By default current month blogposts are displayed. You can choose previous months if you want.

Thanks for your time,

Kostas


author: Andrew Frayling
body: Ah, ok. Can't think of how to do that out of the box. Shouldn't be too difficuly to do that with a user macro though, I'll have a play and see if I can come up with something.


author: Andrew Frayling
body: Hi Kostas,

Sorry for the delay, try this User Macro:

```
## Macro title: List Blog Posts## Macro has a body: Y or N (N)## Body processing: Selected body processing option## Output: Selected output option#### Developed by: Andrew Frayling## Date created: 13/04/2012## Installed by: &lt;your name&gt;## Macro to display blog posts for the current and previous months## @noparams#set ( $allBlogsInSpace = $pageManager.getBlogPosts($space, true) )## get a calendar object for the current date#set ( $currentDate = $action.dateFormatter.getCalendar() )## Define an array of Month names#set ( $monthArray = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] )## set the current month#set ( $currentMonthNum = $currentDate.get(2) )#set ( $currentMonth = $monthArray.get($currentMonthNum) )## Display posts for the current month&lt;h3&gt;$currentMonth&lt;/h3&gt;#foreach($blog in $allBlogsInSpace)  #if ($blog.getPostingMonth() == $currentMonth)    #contentLink2($blog, true, false) $blog.getPostingDayOfMonth() $blog.getPostingMonth() $blog.getPostingYear()&lt;br /&gt;  #end#end## set the previous month#set ( $previousMonthNum = $currentDate.get(2) - 1 )#set ($previousMonth = $monthArray.get($previousMonthNum) )## Display posts for the previous month&lt;h3&gt;$previousMonth&lt;/h3&gt;#foreach($blog in $allBlogsInSpace)  #if ($blog.getPostingMonth() == $previousMonth)    #contentLink2($blog, true, false) $blog.getPostingDayOfMonth() $blog.getPostingMonth() $blog.getPostingYear()&lt;br /&gt;  #end#end
```

It's not as fancy as the functionality on the viewrecentblogposts.action page, but it will list the blogs posted in the current month and the blogs posted in the previous month.

Hope it's of some help.

Andrew.


author: Tsol
body: Hi Andrew,

Thanx a lot for you help. I have just installed your macro and works fine. I'm already using it.

Thanx again.

Kostas


Tags: blog

user-macro