Creating a Blog Summary Page in Confluence

Here’s a guide on how to create a blog home / summary page in Confluence that mimics traditional blog platforms layout and functionality. Displaying Recent Comments and Labels works best if the blog posts are in a dedicated Confluence Space.

Blog preview

Page Layout

Create the 2-column page layout using a Section Macro and 2 Column Macros with widths of 65% and 35% for the left and right hand columns respectively.

Blog Layout

Left Hand Column

In the left hand column insert a Blog Posts Macro configured with the following parameters:

Content Type to Display: excerpts
Time Frame: 31d
Maximum Number of Blog Posts: 100
Sort By: modified
Reverse Sort: checked

All other parameters left blank.

Right Hand Column

In the right hand column insert 3 Panel Macros with the relevant titles: Recent Posts, Recent Comments and Labels.

In the first Panel Macro insert a Recently Updated Macro with the following parameters:

Width of Table: 100%
Include these Content Types Only: blogpost
Maximum Number of Results: 15
Theme: concise

All other parameters left blank.

In the second Panel Macro insert a Recently Updated Macro with the following parameters:

Width of Table: 100%
Include these Content Types Only: comment
Maximum Number of Results: 15
Theme: concise

All other parameters left blank.

In the third Panel Macro insert a Popular Labels Macro with the following parameters:

Number of Labels to Display: 100
Restrict Labels to this Space Key: <the key of your blog space, e.g. BLOG>
Style of Labels: heatmap

As mentioned above, displaying Recent Comments and Labels works best if the blog posts are in a dedicated Confluence Space as there are no Recently Updated Macro parameters that allow you to specify “blog comments” as opposed to comments on pages nor are there macro parameters that allow you to restrict the Popular Labels Macro to labels applied to blog posts only.

Related Links

Tips via Twitter for Confluence enterprise wiki

Got a Confluence tip? Tweet it now then see it in the Confluence docs.

 

Tracking Confluence Attachment Downloads with Google Analytics

If you’re using Google Analytics to track Confluence usage – and if not, why not, David Simpson has an excellent guide on tracking Confluence usage with Google Analytics – you may have noticed that Google Analytics doesn’t track attachment downloads. This is because downloads such as PDFs, Word Docs, Powerpoint Presentations, etc. are not web pages and therefore do not include the Google Analytics tracking code. Fortunately there is a solution based on this support document from Google:

1. Login to Confluence as a Confluence Administrator
2. Select Browse -> Confluence Admin
3. Select Look and Feel -> Custom HTML and enter the following JS snippet in the “At end of HEAD” section in addition to your Google Analytics tracking code:

<script>
AJS.toInit(function() {
  AJS.$("a[href*='/download/attachments/']").click(function() {
    _gaq.push(['_trackPageview', AJS.$(this).attr('href')])
  });
});
</script>

4. Click Save

After 24-48 hours you should then see your attachments being tracked in Google Analytics under Content -> Site Content -> Pages:

Google Analytics Page View

Happy Tracking :-)

Related Links

Tips via Twitter for Confluence enterprise wiki

Got a Confluence tip? Tweet it now then see it in the Confluence docs.

 

Confluence Blog Posts Macro Not Updating

A popular feature in Confluence is the ability to create blog posts and aggregate them using the Blog Posts Macro. In order to improve performance the Blog Posts Macro applies an aggressive caching mechanism and it is not uncommon for new blog posts to take a while to appear in the list of posts generated by the macro.

If posts are taking an unusually long time to appear you may need to rebuild Confluence’s indexes:

1. Login to Confluence as a Confluence Administrator
2. Select Browse -> Confluence Admin -> Administration -> Content Indexing
3. Rebuild both the “Search Index” and “Did You Mean Index”

Sometimes, however, the caches and indexes may have become corrupted and rebuilding the indexes via the Confluence UI does not resolve the issue. In this case the indexes may need to be manually rebuilt from scratch:

1. Shutdown Confluence
2. If it exists, backup your <Confluence Home>/index/plugin directory
3. Delete your <Confluence Home>/index directory
4. Create a new <Confluence Home>/index directory and copy in the <Confluence Home>/index/plugin directory from step 2
5. Restart Confluence
6. Follow the steps 1-3 above to rebuild Confluence’s indexes

Hopefully that should resolve the issue and you should not have to go through this manual rebuild from scratch too often, but it may be necessary if the caches and/or indexes become corrupted again.

Related Links

Tips via Twitter for Confluence enterprise wiki

Got a Confluence tip? Tweet it now then see it in the Confluence docs.

Confluence List Space Administrators User Macro

A recent question on Atlassian Answers asked if it was possible to display a list of Confluence Space Administrators to end users so that the end users could go directly to a Space Administrator to ask for permissions rather than having to go via the Confluence Administrators, who would then have to contact the Space Administrators to confirm that it was OK to grant the permissions, causing a delay in the process.

Detailed below is a simple user macro that lists all of the users with administration permissions on the current space with the profile card hover so that users can visit the administrators’ profiles and view their contact details. The macro lists users that have administration permissions inherited from group memberships and from being a Confluence Administrator in addition to the users who have explicitly been granted administration permissions on their individual accounts.

List Space Administrators

To create the macro:

1. Login to Confluence as a Confluence Administrator
2.  Select Browse -> Confluence Admin
3. Select User Macros -> Create a new user macro
4. Enter the information as provided below:

Edit Space Admin Macro

 Template:

## Macro title: Space Administrators
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Date created: 21/03/2012
## Installed by: <your name>
## Macro to display a list of user that are able to administer the current space.
## @noparams

#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
#set($users = $userAccessor.getUsers())

<table class="confluenceTable">
  <tr>
    <th class="confluenceTh">Space Administrators</th>
  </tr>

  #foreach($user in $users)
  ## list the users who can administer the current space
  #if ($permissionHelper.canAdminister($user, $space))
    <tr>
      <td class="confluenceTd">#usernameLink($user.name)</td>
    </tr>
  #end
#end
</table>

5. Click Save

You can then use the following macro when editing a page:

{spaceadmins}

Or select the macro from the Macro Browser via Insert -> Other Macros:

Insert Space Admin Macro

Hope you find it useful :-)  The source code for this user macro is available on Bitbucket.

Related Links

Tips via Twitter for Confluence enterprise wiki
Got a Confluence tip? Tweet it now then see it in the Confluence docs.

Confluence Source Editor

When Atlassian took the brave/clever/stupid/awesome/crazy1 decision with the release of Confluence 4 to remove the wiki markup editor and only provide a single WYSIWYG editor, the reaction was, er, let’s call it “mixed.” Many people, myself included, think the new editor is very slick, very useable and it makes it very easy to quickly create rich-content pages, but there are a lot of people who are seeing real issues with the new editor, particularly around formatting and the lack of ability to edit the underlying XHTML, and had very strong views that the ability to edit wiki markup and/or the source XHTML should be reinstated.

Fortunately, Atlassian are one of the few companies that actually listen and respond to their customers and they quickly set up a page to gather customer feedback which has recently resulted in the release of the beta version of the Confluence Source Editor. The source editor plugin is compatible with Confluence 4.1.5 and above and can be downloaded from the Atlassian Plugin Exchange.

After installing the source editor plugin you will see a new icon when you edit pages:

Edit Source Icon

which will give you the ability to edit the raw Confluence XHTML Storage Format:

Confluence Source Editor

Your Opportunity to Shape Development

As mentioned, Atlassian are one of the few companies that positively react to customer feedback and this is your chance to shape the development of the source editor. This is just the beta release and Atlassian are welcoming feedback / bug reports and are also asking for YOUR input to the specification for the editor.

So it’s over to you :-) Download the plugin, install it, play with it and have your say on its development. It is only available for Confluence 4.1.5 and above, but even if you are on a lower version it takes less than 30 minutes to download and be up and running on an evaluation version of the latest release so that you can try it out.

Related Links

1 – delete as appropriate per your view point