Templates
If a collection’s files share a shape, like the same headings in every book review, or tags that are nearly always set, a template saves typing it each time. New files in the collection start as a copy of it.
Adding a template
Section titled “Adding a template”Create a folder called .astro-editor in the collection’s folder, the one you browse in the sidebar, and a file called template.md in it:
Directorysrc/content/
Directoryreviews/
Directory.astro-editor/
- template.md
- 2026-11-02.md
- 2026-11-09.md
Write it as you’d write any file in the collection:
---# Fill in the rating once you've finished ittitle: Book TitlepubDate: 2024-01-01rating: 3tags: - books---
## Summary
## What I thoughtAstro’s loaders don’t look inside folders whose names start with a dot, so with the usual collection patterns, Starlight’s included, the template is never part of your site. Astro Editor doesn’t list it either, so you edit it in your IDE or another editor. On a Mac, Finder hides the folder too, until you press Cmd+Shift+. in Finder to show hidden files. The collection’s page in Project Settings shows the template’s path, with buttons to copy it or open it in your IDE.
A template only applies to its own collection, and only from the collection’s folder. A .astro-editor folder in a subfolder is ignored.
What a new file gets
Section titled “What a new file gets”
- The template’s title is the placeholder title, which is selected so you can type over it.
- The published date is today, whatever the template says.
- Required fields the template leaves out are filled in as they are for any new file.
The file is named by the collection’s file name pattern, as usual.
Markdown and MDX
Section titled “Markdown and MDX”A template can be template.md or template.mdx. Either way, the new file gets the collection’s new file type, so a template.md with a few headings works for an MDX collection. If you use MDX imports or components in a template for a Markdown collection, they’re copied into the Markdown file as they are, and you’ll need to change the collection’s type or the template. If the folder has both, the one matching the new file type is used.
Relative paths
Section titled “Relative paths”Write relative paths in a template, like MDX imports and images, as they’ll be in a new file at the collection’s folder, not from the .astro-editor folder. Your IDE may mark them as missing while you edit the template.
Creating files from outside Astro Editor
Section titled “Creating files from outside Astro Editor”The new action of the URL scheme creates a file the same way, from the template, so you can capture notes from Raycast, Shortcuts or a bookmarklet.