Need some help customizing a Confluence email template

Dave Drexler October 31, 2012

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

0 votes
Radek Antoniuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 31, 2012

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.

Dave Drexler November 6, 2012

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.

Radek Antoniuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2012

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
TAGS
AUG Leaders

Atlassian Community Events