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

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

1 answer

1 accepted

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 to insert a {redirect} macro on the dummy page pointing to viewrecentblogposts.action

Hope that helps?

Andrew.

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

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.

All right,

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

Thank you Andrew

Kostas

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

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.

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

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.

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: <your name>

## 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
<h3>$currentMonth</h3>
#foreach($blog in $allBlogsInSpace)
  #if ($blog.getPostingMonth() == $currentMonth)
    #contentLink2($blog, true, false) $blog.getPostingDayOfMonth() $blog.getPostingMonth() $blog.getPostingYear()<br />
  #end
#end

## set the previous month
#set ( $previousMonthNum = $currentDate.get(2) - 1 )
#set ($previousMonth = $monthArray.get($previousMonthNum) )

## Display posts for the previous month
<h3>$previousMonth</h3>
#foreach($blog in $allBlogsInSpace)
  #if ($blog.getPostingMonth() == $previousMonth)
    #contentLink2($blog, true, false) $blog.getPostingDayOfMonth() $blog.getPostingMonth() $blog.getPostingYear()<br />
  #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.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,803 views 26 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you