Reference
Templates
Templates in Strife serve as the foundation for creating structured and consistent content. These predefined templates establish the fields, and structure, for all content stored in the database.
There are two types of templates in Strife; Document Templates and Content Templates.
Document Templates
The Document Template serves as template for creating documents in the database. It can incorporate various fields types to meet diverse needs.
In addition to defining the fields and structure, there are several other significant aspects of the document template worth exploring.
Collection
The document template specifies the collection name, which is utilized to query the database for all content created using that particular template. This collection name is assigned during template creation and is stored within the metadata section of each document in the database.
"@metadata": {
"@collection": "Posts",
...
}If you are using C#, the collection name is stored alongside the Type property to facilitate model binding and serialization. For how content is bound to your C# models, see Rendering Content in the .NET guide.
The Collection plays a crucial role in utilizing and comprehending RavenDB. For a deeper understanding of RavenDB, please explore additional resources available here.
URL
Content created from a document template is treated as web pages: a URL is generated and indexed from the content's slug and its place in the page tree. Content templates have no URL of their own; their content is reached by querying the database or through the content that holds it.
For additional details on the URL indexing, please refer to this resource.
Content Templates
The Content Template serves as a reusable preset of fields designed for integration within a Document Template or a Chapters field. It's important to note that a Content Template is not meant for creating documents in the database. Instead, any content generated from a Content Template is always stored within the document that uses that particular Content Template.
Creating templates
Templates are defined in code with defineType and deployed to a team with strife push. See Schemas.