Variables in Flare are a powerful tool. They make it easy and efficient for authors to reuse and manage commonly used text such as company and product names. They are also great for dynamically displaying an important date and time on a page, such as the last time a topic was updated.
Adding the date a topic was last updated can be helpful for you as the author because it allows you to keep track if a topic needs to be updated with new, helpful information. It’s also meaningful for the end-user to see the last time a topic is modified because it gives the documentation more credibility and trust when they can see that the information is up-to-date.
Adding the last updated date to a topic can be a tedious step to remember to do manually. In this blog, we will explain how to add a date and time variable that displays on every topic and automatically updates every time the topic is saved.
Create a Custom Date/time Variable
The first step is to create a custom date/time variable.
- In Flare, open the Project Organizer.
- Click the Variables folder.
Your variable sets are displayed. - Double-click the variable set to open the Variable Set Editor.
In this example, the variable set is named “General”.
- Select the Add DateTime Variable button.
This will create a new variable in the variable set.
- Name the variable.
We have named ours “LastSavedDate”. - Click in the Definition cell for the variable.
The Edit Format dialog opens. - In the Enter Format Specifiers field, enter a combination of format specifiers for the desired date and time format.
For a [Month] [Day], [Year] format, copy and paste: MMMM dd, yyyy. Specifiers are based on Microsoft's custom date and time format strings.
For more specifier combination examples that you can use in this field, see the Flare online Help. - Select On File Save in the Update field.
This configures the variable to display the last time the topic was modified.
Inserting the Variable into a Template Page
After the variable is created, the next step is to insert it into a template page.
Instead of adding the variable to each individual topic, we can instead insert the variable into a Template Page. This will allow you to display the date and time on each page of your output and will update in the output as if they are a part of the topic.
- From the Content Explorer, open the Template Page.
- Place your cursor in the template page where you want to insert a custom date/time variable.
If you insert it above the Topic Body proxy, the date, and time are shown in the header (above the topic content).
If you insert it below the Topic Body proxy, the date, and time are shown in the footer (below the topic content). - From the Ribbon, select Insert > Variable.
- The Variables dialog opens, with the variable set(s) on the left and the variables associated with the selected set on the right.
- On the left side of the dialog, select the custom variable set that you created.
- Click OK and Save. The custom date/time variable is added to the template page.
Optional: Add text to go along with the date variable, like the example below.
Tip: For more information on template pages and how you can put them to work, visit this blog post.
Build your HTML5 target, and you’ll see that each topic will have a unique last modified or last updated date! Every time the topic is edited and saved in Flare, this date will automatically be updated in the output after it is built.