Skip to main content
Skip table of contents

Add blog templates

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 > Apps > 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

CODE
<!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

CODE
<!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:

CODE
<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. You can track progress at VPRT-603

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.