Hey guys,
I would like to split the "Created and last modified by" into parts.
The goal is to have both the creation-date aswell as "last-modified".
Is it possible for pages and blog-entries?
Hi Tim,
Pages and BlogPosts inherit everything from AbstractPage which includes getCreator(), getCreationDate(), getLastModifier() and getLastModificationDate().
What do you want to do exactly, maybe I can help?
Regards
Theresa
Hi Theresa,
it would be perfect if where the "Created and last modified by [...] about 2 hours ago" appears, confluence would show the CreationDate AND next to it the LastModificationDate.
How can I implement it?
Thanks for the answer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It resolves to something like the following unreadable lines:
#set($page = $blog) #if ($page.isNew()) #set ($dateLink = "$!req.contextPath/pages/viewpreviousversions.action?pageId=$page.id") #else #set ($dateLink = "$!req.contextPath/pages/diffpagesbyversion.action?pageId=$page.id&selectedPageVersions=$page.previousVersion&selectedPageVersions=$page.version") #end #* Note: bunched up else statements are intentional, otherwise we get whitespace that messes up formatting ;) *# #if (!$renderStatic) #set ($authorWithHtml = "#if($page.creatorName) #userLink($page.creator)#else $i18n.getText('anonymous.name')#end") #set ($editorWithHtml = "#if($page.lastModifierName) #userLink($page.lastModifier)#else $i18n.getText('anonymous.name')#end") #else #set ($authorWithHtml = "#if($page.creatorName) $page.creatorName#else $i18n.getText('anonymous.name')#end") #set ($editorWithHtml = "#if($page.lastModifierName) $page.lastModifierName#else $i18n.getText('anonymous.name')#end") #end #set ($authorWithHtml = "<span class='author'>$authorWithHtml</span>") #set ($editorWithHtml = "<span class='editor'>$editorWithHtml</span>")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without writing a plugin, you could edit the page decorators.
For the blog post page:
You'll find a line like
#parse ("/decorators/includes/page-metadata.vm")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
... and ...
#if ($generalUtil.isDateWithin24Hours($page.lastModificationDate) && !$renderStatic) #set ($i18nSuffix = ".ago") #set ($modifiedDate = $friendlyDateFormatterHelper.format($page.lastModificationDate)) #else #set ($i18nSuffix = ".on") #set ($modifiedDate = $dateFormatter.format( $page.lastModificationDate )) #end #if (!$renderStatic) #set ($modifiedDate = "<a class='last-modified' title='$dateFormatter.formatDateTime( $page.lastModificationDate )' href='$dateLink'>$modifiedDate</a>") #end #if ($page.isNew()) $i18n.getText("created.by$i18nSuffix", [$authorWithHtml, $modifiedDate]) #else #if ($page.creator == $page.lastModifier) $i18n.getText("created.and.modified.by$i18nSuffix", [$authorWithHtml, $modifiedDate]) #else $i18n.getText("created.by.modified.by$i18nSuffix", [$authorWithHtml, $editorWithHtml, $modifiedDate]) #end #end
You can replace the original velocity macro and edit it. The last few lines handle the actual text to display and can easily be edited.
BUT: You should be aware that this is (or should be) resetted after updating Confluence, since this markup may change, too.
Hope I could help
Theresa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, this was exactly what I was looking for.
Have a nice weekend!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Theresa,
it would be perfect if where the "Created and last modified by [...] about 2 hours ago" appears, confluence would show the CreationDate AND next to it the LastModificationDate.
How can I implement it?
Thanks for the answer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.