Time invested in building a complex layout or crafting high-quality quality content should not be wasted. Instead of crafting single-use content, you should have the ability to turn it into a reusable template that can be used as a starting point for future content. This is what Apostrophe's Template Library is all about!
“Blank page” syndrome refers to a common problem in which we feel daunted by the blank canvas in front of us. Where to start? What to do? The pressure of having to create something prevents us from thinking. The answer is to apply a previously created template!
In this article, you will explore the full potential of the Template Library module, understanding what it is, what it adds to Apostrophe, and how to use it.
What Is Apostrophe's Template Library?
Apostrophe's Template Library is one of the advanced extensions available with Apostrophe Pro. The module enables editors to create templates containing pre-filled content or pre-designed layouts. The ultimate goal is to address the “blank page problem,” making it faster and easier to create content from scratch while promoting reuse and improving productivity.
The most powerful feature offered by the module is the ability to transform existing content into a reusable template. Thus, you still need to create content from scratch, but only the first time. Then, you can transform it into a template and apply it to initialize new content with only a few clicks.
- Page templates: To simplify the design of new pages.
- Piece templates: To facilitate the creation of new content instances such as blog posts or calendar events.
Why You Need the Template Library Module
We have all experienced at least once that feeling of uncertainty and hesitation when staring at a blank canvas. Whether it is writing a blog post or designing a web page, the blank page in front of us is scary. This phenomenon is also known as “blank page syndrome” and represents a common challenge faced by content creators.
That creative block often results in delays and decreased productivity. The reason is that we tend to struggle when creating something new without any initial guidance or structure. To address this significant hurdle in content creation, the team behind Apostrophe introduced the Template Library. This Pro module fights the "blank page syndrome" by providing content creators with a toolkit for managing templates. Once created, these templates serve as starting points for new content. Specifically, they serve as a structured foundation to begin from when adding new pages or pieces in Apostrophe.
Another major advantage of Apostrophe's Template Library is that it kick-starts the work of content creators. This in turn results in increased productivity, as editors can focus on refining existing content to meet new needs, rather than spending a lot of time creating something new.
Templates also play a crucial role in supporting content and style governance, as they promote reusability. For example, they implement a specific template or consist of several common components. This means that any product page, article, or any other type of content can follow the same rules easily. In other words, larger content teams can adopt the workflow based on templates to ensure a consistent look and feel throughout the site.
In short, the Template Library enables editors and content creators to break free from “blank page syndrome,” supporting creativity and efficiency. Plus, each template provides a set of guidelines, helping content teams maintain a cohesive online presence through a consistent UI and UX.
Digging into the Template Library Module
Now that you know the ‘why’ behind the Template Library, it is time to take a look at its features to discover what the module has to offer.
Before getting started, keep in mind that the Template Library is a module only available in Apostrophe Pro and Apostrophe Assembly. Compare our plans and find the right one for you on our pricing page.
Follow our guide “How To Set Up the Template Library Pro Module in Apostrophe” for technical instructions on how to install the extension.
In the examples below, we will assume that your Apostrophe application has three page types (“Default,” “Article index,” and “Home”) and a single piece type (“Article”).
Create a New Piece or Page Template
Click on the “Doc Template Library” button in the upper right corner to reach the “Manage Templates” modal:
The list of templates is currently empty, as you have not yet added one. Time to see how to create a new template!
Press the “New Template” button. This will open the template creation modal below:
Here, you can give your template a name, add a preview image, and select
piece-types currently registered in the project.
If you select a page type, the template will only be applicable to pages. If you instead select a piece type, you will only be able to use it with pieces.
The preview image is optional. If you do not specify it, Apostrophe will display a static preview of the template using an
iframe. We will soon see how that works when analyzing the template dashboard.
Note: You can apply templates only when creating new pieces or pages but not on already existing resources.
Learn how to create piece and page templates in two examples!
Create and Apply a Page Template
Reach the template creation modal and select the content type “Page.” This will show some new options under the “Optional Preview Image” field. In detail, you also have to choose the page type associated with the template:
Select “Default” and hit the “Save” button.
Apostrophe will now show the template edit page below:
Click “Edit” in the upper right corner to enable in-context editing. Suppose your goal is to define a template for landing pages:
Here is what your template may look like. It simply involves an image, a title, a description, and a CTA button to promote one of your services. In a real-world scenario, you could add more text and image elements to make the page richer.
Apostrophe will save the template for you after every edit. So, you can leave the page without losing your work. When creating a new page, you can now choose the template to avoid starting from scratch. See how!
Click on “Pages” in the top menu and select the “New Page” button.
In the page creation modal, select “Template,” hover over the CTA page template, and then hit the “Apply Template” button.
The main content of the new page will now contain the same elements specified when crafting the template.
It only remains to complete the details, then click “Publish.”
With a few clicks, you have just created a new page. What a productivity boost! Designing a page has never been faster and easier.
Create and Apply a Piece Template
In the template creation modal, select the “Article” piece, call your template “General Article Template,” and add a placeholder image as below:
Press the “Save” button.
You will be redirected to the following page:
This is where you can edit your piece template. Click “Edit” in the upper right corner and create a text template for your articles:
For example, you can create a template including instructions and tips for writing great articles with a consistent structure and closing CTA.
When adding a new Article piece instance, you will now have the ability to select the above template. Let’s see how!
Click “Articles” in the top menu on the left and hit the “New Article” button.
In the piece creation modal, click “Template,” hover over the article piece template, and then select “Apply Template.”
Note that the page template created in the previous section is not available for selection as you are dealing with a piece, not a page.
The text field of the piece instance will now contain the same content defined in the template:
Now, complete the piece instance with the remaining details and click “Publish.”
As you can see, piece templates streamline the process of creating new content. The creative block due to the blank page will disappear immediately after applying a template.
Template Exploration Dashboard
Click on the “Doc Template Library” button in the upper right corner to open the template exploration dashboard.
Here, you can explore the page and piece templates. Notice that the template cards contain the image you chose at creation time or an automatic preview. In this latter case, Apostrophe uses an
So, what you see is the actual rendering of the HTML page you designed.
Page templates and piece templates behave differently. When you hover over a page template, you get access to two buttons:
- Edit Settings: Open the page update modal.
- Edit Layout: Opens the page in preview mode for in-context editing of the template layout.
Instead, a piece template will only have the “Edit Settings” buttons.
Whenever you edit a template, a yellow bar appears at the top of the template to warn you that what you are working on is not a public page.
Note that editing a template will not affect pages or pieces already created.
Apostrophe’s Template Library module offers other interesting features. Take a look at the most important ones.
Duplicate a Template
Another way to create a new template is to duplicate an existing one. To do so, select a template, click “Edit Settings”, press the “⋮” button, then click “Duplicate...” in the menu.
This will create a copy of the template, which can then be edited without affecting the original one.
Archive a Template
If you no longer need a template, you can archive it like any other resource in Apostrophe. Open the template exploration dashboard, select the templates you want to remove, and click “Archive.”
The selected templates will be gone. Note that this operation will have no effect on existing pages or pieces.
Save an Existing Page or Piece as a Template
Existing pieces and pages can be added to the template library either from the tree view or while editing the resource. In both cases, open the “⋮” menu and select the “Save as template...” option.
This will bring up a modal that allows you to change the template title and content.
Manage Template Permissions
By default, users with “Admin” or “Editor” permissions can fully edit and apply library templates. On the other hand, users with the “Contributor” role can apply existing templates to any page or piece but cannot edit them or create new ones.
For a more granular control, you need to enable the
@apostrophecms-pro/advanced-permission Pro module. In the group permissions grid provided by the extension, you will see a "Templates" row:
When left to “None,” users who are assigned to the group will not be able to see the template library at all. If assigned to “Editor”, then users will be able to see all templates in the library. However, they will only be allowed to edit a template if they also have permission to edit that document type. Similarly, they will only be allowed to apply that template to documents that they have permission to edit.
Thanks to the Template Library module, all you have to do is initialize a new page with the right design template, as in the video below:
ApostropheCMS Apply Template
In this guide, you jumped into the Apostrophe Pro’s Template Library module. You understood what the module is and what it brings to the table. In particular, you saw how it helps you create and manage reusable content templates to speed up your work.
By following this article, you learned how to get the most out of each of its features to achieve productivity and consistency benefits. Fear the “blank page” in front of you no more, Apostrophe's Template Library extension is here to the rescue!