Page Templates
Page templates are special templates, which are selectable from the ‘Page Template’ dropdown in the page editor by an author.
You’ll typically use page templates for things like a homepage, or any page which has a special layout or purpose.
To create a page template, create a new view in the ‘views’ folder. You can call the template anything you like, but it’s recommended that it start with template-, or be in a templates subfolder.
It should export a view created with the defineView function, and must also define a meta: ViewMeta constant, with the templateName property set.
import { defineView } from "eddev/views"
export const meta: ViewMeta = {
templateName: "Special Page"
}
export default defineView("template-special-page", () => {
return (
<div>
<h1>Special Template!</h1>
</div>
)
})Other Post Types
By default, providing a templateName metadata value will mark the view as a page template, available on ‘Page’ posts only.
You can optionally also specify one or more post types:
export const meta: ViewMeta = {
templateName: "Editorial",
postType: ['article']
}