Creating Pages with the Current Date in the Page Title
Scenario
You may 'force' creation of pages with a standardized page title. This is useful when you are organizing meeting notes pages, budget documentation, status updates, or any time-sensitive documents.
By using an 'injection' notation (sample in the Steps section), you can dynamically add the current date to a page title.
Result
Recipe
Apps | Linking for Confluence Server |
---|---|
Platform | Server and Data Center |
Level | Intermediate |
Estimated time | 15 minutes |
Macros | Add Page |
Suppliers | N/A |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<h2>Meeting Notes</h2> <hr/> <p> <ac:structured-macro ac:macro-id="b55ea749-f097-4051-ade1-9e50e8833bc1" ac:name="children" ac:schema-version="2"> <ac:parameter ac:name="sort">creation</ac:parameter> <ac:parameter ac:name="reverse">true</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="b80ffac8-1fc4-4497-a7aa-33ae44c57e92" ac:name="add-page" ac:schema-version="1"> <ac:parameter ac:name="name">Meeting Notes for %global:current date>date:MMM d, yyyy%</ac:parameter> <ac:parameter ac:name="linkText">Create a new meeting notes</ac:parameter> <ac:parameter ac:name="source">Meeting notes template</ac:parameter> <ac:parameter ac:name="live">true</ac:parameter> </ac:structured-macro> </p>
Macro structure
You can recreate the example in the editor view:
Steps
Add an Add Page macro.
To set the title of the pages to be created, fill out the Page title parameter. In this example, we want to create the pages with title format 'Meeting Notes for Feb 20, 2018', so we will use an 'injection' notation with a keychain from Date Supplier:
Meeting Notes for %global:current date>date:MMM d, yyyy%
This can be customized to your liking, see full description here. For example:%global:current date>date:yyMMdd% will appear as 170814.
%global:current date% will appear as Mon Aug 14 16:05:16 MYT 2017.
%page:creation date% will appear as 2017-08-14 14:46:51.553.
For the link inside the current page, let's specify 'Create a new meeting notes' as Create link text.
If you want to create the pages based on a template, fill out the Source, Source Type and check the Live Template parameters.
Add a Children Display macro, to show the list of pages created through this Add Page macro.
Line-by-Line Explanation
N/A