Need some help customizing a Confluence email template

Hi folks - I'm having a hard time getting the result I want from a customized "editpage-notification.vm" template.

First question: am I editing the Velocity code correctly?

This is the template for HTML emails, not the text-only emails. I want an <h2> heading, followed by 2 <h4> headings announcing the page that changed and the person who changed it. After that, if a version comment exists, I want that comment to display. Lastly, I want the standard set of links that already appear in these emails. Here's the code I'm using:

#parse ("templates/email/html/includes/header.vm")
    &lt;h2&gt;NaviNet Page Change Notification&lt;/h2&gt;
	&lt;h4&gt;Page that changed: &lt;a href="$baseurl$content.urlPath"&gt;$content.title&lt;/a&gt;&lt;/h4&gt;
    &lt;h4&gt;$i18n.getText("email.notification.$contentType") $i18n.getText("email.html.edited.by") #emailUserLink ($modifier $baseurl)&lt;/h4&gt;
	#if ($content.renderedVersionComment &amp;&amp; $content.renderedVersionComment.length() &gt; 0)
    &lt;br/&gt;
    &lt;div id="versionComment"&gt;
        &lt;h4&gt;$action.getText('comment.name'):&lt;/h4&gt;
        $content.renderedVersionComment&lt;br /&gt;
    &lt;/div&gt;
    #end
    &lt;br/&gt;
    &lt;div id="commentsSection" class="wiki-content pageSection"&gt;
        #parse ("templates/email/html/includes/watch-links.vm")
        &lt;a href="${baseurl}$content.urlPath"&gt;$i18n.getText("email.notification.view.online")&lt;/a&gt;
        |
        &lt;a href="${baseurl}/pages/diffpagesbyversion.action?pageId=$content.id&amp;revisedVersion=$content.version&amp;originalVersion=$originalContent.version"&gt;$i18n.getText('email.notification.view.changes')&lt;/a&gt;
        #if ($permissionHelper.canComment($remoteUser, $content))
        |
        &lt;a href="${baseurl}$generalUtil.customGetPageUrl($content)showComments=true&amp;amp;showCommentArea=true#addcomment"&gt;$i18n.getText("add.comment")&lt;/a&gt;
        #end
    &lt;/div&gt;
#parse ("templates/email/html/includes/footer.vm")

Second question: where exactly should the edited file live?

The documentation here says the file needs to go into a jar file: https://confluence.atlassian.com/display/DOC/Customising+the+eMail+Templates

But our hosting service says the file should live here on their server:

/opt/j2ee/domains/navinet.net/partner/webapps/atlassian-confluence/deployments/current/exploded_war/WEB-INF/classes/templates/email/email/editpage-notification.vm

But when they put the file there and restart Confluence, it has no effect.

Who's right - the Atlassian doc or the hosting service?

1 answer

By the path from your hosting provider, I am guessing that WAR version is being used. Isn't it like, when Confluence is restarted, the WAR is getting re-deployed thus overwriting your changes in the mentioned file? That would mean you have to re-package the WAR file.

Thank you, Radoslaw. According to our hosting provider, they unzip the WAR into the exploded_war directory, and that's what gets read into cache. They put my edited file into the exploded_war directory, so that was/should have been read into cache.

I'm not clear on why, but the custom templates are now working.

Maybe they were leaving the "non-patched" war somewhere around or were not restarting the server.

Anyway great, glad that it is working!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

865 views 23 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you