×

You're using an outdated browser

For a better experience, keep your browser up to date. Check here for the latest version.

Manual

Add blog templates

Thomas Walker

Thomas Walker Last update: Oct 17, 2017

Templates for blogs are split up in two types – blog overview templates and blog post templates.

Make sure to check the 'Blog Posts' option on the Space tools > Add-ons > Scroll Viewport > Theme Configure > Content screen. If this is not checked, Viewport won't display blog posts.

Create a blog overview template

Create a blogs.vm file that is used to render the blog overview, category pages and archive pages:

blogs.vm

<!DOCTYPE html>
<html>
 
<head>
    <title>Blog Overview</title>
</head>
 
<body>
    <div class="content">
	 #foreach($blogPost in $blogPosts)
		<h2>$blogPost.title</h2>
		<p>Written by $blogPost.creator.username on $blogPost.creationDate("MMM dd, yyyy")</p>
        <div>$blogPost.content</div>
	 #end
    <div>
</body>
 
</html>

You can also create specific blog overview templates for individual blog categories.

Create a template for an individual blog post

Create a file blog.vm that is used to render the blog view:

blog.vm

<!DOCTYPE html>
<html>
 
<head>
    <title>$page.title</title>
    $include.template("include-htmlhead.vm")
</head>
 
 
<body>
    <div class="header">
        $include.template("include-header.vm")
    </div>    
     
    <div class="content">
        $page.renderContent("layouts/layout.vm")
    <div>        
     
    <div class="footer">
        $include.template("include-footer.vm")
    </div>
</body>
 
</html>

You can also create specific blog post templates for individual blog categories. 

Create a template for a blog category

If you need Viewport to filter blog categories, this can be done using the following URL:

<confluence-base>/<path-prefix>/blog/category/<category-name>

Create a blogs-<category>.vm file that is used to render the blog overview, or a blog-<category>.vm file for just a single blog post within this category. Categories are represented in Confluence as tags.

At the moment this feature is not working as expected, however we're already working on a fix. You can track progress at VPRT-603

2x2.11
We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information: click here.
Ok