It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Tsol Apr 02, 2012

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

1 vote
Answer accepted
Andrew Frayling Apr 03, 2012

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.

Tsol Apr 04, 2012

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

Andrew Frayling Apr 04, 2012

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.

Tsol Apr 04, 2012

All right,

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

Thank you Andrew

Kostas

Tsol Apr 09, 2012

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

Andrew Frayling Apr 09, 2012

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.

Tsol Apr 09, 2012

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

Andrew Frayling Apr 09, 2012

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.

Andrew Frayling Apr 12, 2012

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.

Tsol Apr 16, 2012

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

933 views 0 19
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you