Eggspress comes with a set of template files, two for each of the content types (posts, pages, authors, categories, and sidebars). They are easy to use and let you create new posts quickly.
Why use templates
Eggspress brings together individual content files to build into a site. In addition to the text and images that fill the body of a page, these files also include a lot of frontmatter, which holds data about:
- Metadata
- References to other files
- Settings unique to the content's rendered page
While it's easy enough to copy and paste frontmatter from the most recent post into a new post, doing so can often result in errors. For example, you may forget to update the date
field or set the correct relatedPost
.
Templates give you a fresh start with each new content file you create.
Using templates with Obsidian
Obsidian is our recommended desktop editor because its features make publishing on Eggspress a breeze. One benefit of using Obsidian is that it has a dedicated function for inserting templates.
To use a template in Obsidian:
- Create a new note and give it a filename
- Click the "Insert template" button on the left-hand ribbon
- Select the template you wish to insert
- Begin editing your new file
You'll notice that title
will be pre-populated using the filename you gave your file. date
will also have the current time.
Using templates with other editors
If your desktop editor supports templates, you'll want to set your templates folder to my_templates
. Otherwise, the best way to use templates is to locate the template you want from my_templates
and copy and paste its contents into a new file.
Creating new templates
If you find yourself modifying the same frontmatter fields over and over again, you might wish to consider creating your own template. To do so:
- Create a copy of an existing template you want to use for your new template
- Rename this file with a descriptive name, but note that it must start with
#
- Set the values for your fields
In Obsidian, you can use the strings "{{title}}
" and "{{date}}
" in your templates. Obsidian will automatically replace these strings with the filename of your target file and the current date, respectively.
To change the date format,
- Open settings (gear wheel icon on the bottom-left corner)
- Select the "Templates" tab
- Set "Date Format" to the format you wish to use