This page last changed on Oct 02, 2009 by ggaskell.

The Blog Posts Macro allows you to display news items (blog posts) on a wiki page. Clicking on a title takes you to the news item. The blog posts macro will generate output like the screenshot below:

Screenshot: The Blog Posts Macro in Confluence

On this page:

Usage with the Macro Browser

To insert the blog posts macro into a page using the Macro Browser,

  1. Open your desired Confluence page, then click the 'Edit' button. The 'Edit Page' mode opens.
  2. Next, click the Macro Browser icon on the editor toolbar. The Macro Browser will open in the middle of the screen.
  3. In the Macro Browser, type the name of your desired macro into the search box at the top right of the window. Macros with a matching name will appear in the centre pane. Click on the desired macro to see its options screen. Here, you can set the macro parameters then click 'insert' to put the macro into the page.

Once you've found the blog posts macro, click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

Simply type the following into the Wiki Markup editor:

{blog-posts}

In the example below, we show the news items from a user's personal space on this Confluence site. (The person's username is ~mryall.)

What you need to type What you will get
{blog-posts:space=~mryall}
Labels: label, label2

This is a test post.

Posted at Oct 16, 2007 by Matt Ryall (Atlassian) | 0 comments

Parameters

Parameters are settings for Confluence macros that allow the user to control their content or presentation. The table below lists relevant parameters for this macro.

Parameter names are displayed differently in the macro browser interface and in wiki markup. Below, parameter names used in the macro browser are indicated in Bold text, while their equivalents in wiki markup are indicated in (bracketed) text. If the latter is not shown, then in wiki markup, the parameter's name should be omitted and only its value should be added immediately after the colon symbol (:).

Parameter Default Description
(author) None Filter the results by author. The macro will display only the news items which are written by the author(s) you specify here.

You can specify one or more authors, separated by a comma.
Content Type to Display
(content)
entire Available values:
  • content=excerpts — Display short excerpts from each news item. After each excerpt, the words 'Read more...' will offer a link allowing the user to click through to the full news item, if the content is over 500 characters long.
  • content=titles — Display a list of news items, showing titles only.
Restrict to these Labels
(label)
None Filter the results by label. The macro will display only the news items which are tagged with the label(s) you specify here.

You can specify one or more label values, separated by a comma or a space.
  • To exclude content which matches a given label, put a minus sign (-) immediately in front of that label value. For example: If you specify a label value of -badpage you will get only content which is not labelled with 'badpage'.
  • To indicate that the results must match a given label value, put a plus sign (+) immediately in front of that label value. For example: If you specify a label value of +superpage,+goodpage you will get only content which has at least two labels, being 'superpage' and 'goodpage'.
Restrict to these Labels
(labels)
None Exactly the same as label above.
Maximum Number of News Items
(max)
15 Specify the maximum number of results to be displayed. Note that the results are sorted first, and then the maximum parameter is applied.
Maximum Number of News Items
(maxResults)
15 Exactly the same as max above.
Reverse Sort
(reverse)
false Use this parameter in conjunction with the sort parameter described below. Set reverse=true to change the sort from ascending to descending order.

this parameter is ignored if the sort parameter is not specified.
Sort By
(sort)
creation Specify how the results should be sorted. To change the sort order from ascending to descending, use the reverse parameter described above.

If this parameter is not specified, the sort order defaults to descending order based on the creation (publish) date.

Values:
  • creation — Sort by the date on which the content was added.
  • title — Sort alphabetically by title.
  • modified — Sort by the date on which the content was last updated.
Restrict to these spaces
(space)
@self, i.e. the space which contains the page on which the macro is coded This parameter allows you to filter content by space. The macro will display only the pages which belong to the space(s) you specify here.

You can specify one or more space keys, separated by a comma or a space.
  • To exclude content in a specific space, put a minus sign (-) immediately in front of that space key. For example: If you specify a space key of -BADSPACE you will get only content which is not in the BADSPACE.
  • To indicate that the results must come from a specific space, put a plus sign (+) immediately in front of that space key. For example: If you specify a space key of +GOODSPACE you will get only content in GOODSPACE. (Note that this is not particularly useful, because each content item belongs to one space only. If you put a plus sign next to one space key and list other space keys too, the other space keys will be ignored.)

Special values:
  • @self — The current space.
  • @personal — All personal spaces.
  • @global — All global spaces.
  • @favorite — The spaces you have marked as favourite.
  • @favourite — The same as @favorite above.
  • @all — All spaces in your Confluence site.
  • * — The same as @all above.

When specifying a personal space, remember to use the tilde (~) sign in front of the username, such as ~jbloggs or ~jbloggs@example.com.

Restrict to these spaces
(spaces)
  Exactly the same as space above.
Time Frame
(time)
no limit Specify how far back in time Confluence should look for the news items to be displayed.

Available values:
  • m — Minutes
  • h — Hours
  • d — Days
  • w — Weeks

    For example, time=12h would display those news items created in the last twelve hours, and time=7d would show news items created in the last seven days.

Examples

1. Specify the number of news items you want displayed

The following code will display a maximum of five news items:

{blog-posts:max=5}

2. Display short excerpts from each news item in the list

{blog-posts:content=excerpts}

3. Display only the titles of the news item

{blog-posts:content=titles}

4. Choose how far back in time Confluence should look for the news items

The following code will display all news items posted in the last twelve hours.

{blog-posts:time=12h}

The following code will display all news items posted in the last 2 weeks.

{blog-posts:time=2w}

5. Filter items using labels

The following code will display news items that contain the labels 'atlassian' or the label 'confluence' (or both):

{blog-posts:labels=atlassian,confluence}

The following code will display news items that contain the labels 'atlassian' and 'confluence' — each news item must be tagged with both labels:

{blog-posts:labels=+atlassian,+confluence}

6. Filter items using spaces

The following code will display items from the 'Marketing' space (space key is MKTG) and Joe Smith's personal space (space key is ~jsmith):

{blog-posts:spaces=MKTG,~jsmith}

7. Combine parameters to filter the news items

The following code will display the latest 10 items in the 'Marketing' space (space key is MKT) with the label 'logo'. The items will be displayed as a list of titles only:

{blog-posts:max=10|labels=logo|spaces=MKT|content=titles}

8. Sort the results

Use the code below to sort the list of items by date last modified, with the most recent at the top:

{blog-posts:sort=modified|reverse=true}
RELATED TOPICS

Working with Macros
Working with News Overview

Take me back to the Confluence User Guide.

Document generated by Confluence on Dec 10, 2009 18:45