Create display templates for your schemas Last updated: 27. Aug 2024
This guide helps you create display templates for your schemas, transforming documents into files such as HTML. Learn to create .hash files that define how your schema documents are rendered for a seamless and customized presentation.
For example, if you have a schema named "Employee", create a file called "#/Employee.hash". This file will render HTML to make Employee documents viewable on your site.
Creating Display Templates
Follow these steps to create a display template for your schema:
- Navigate to the folder where your schema is located.
- Create a new file with the same name as your schema, followed by .hash. For example, if your schema is "Employee", name the file "Employee.hash".
- Write your display template using JavaScript syntax in the .hash file. This template defines how documents of this schema are rendered.
- Save the .hash file in the appropriate folder.
- Publish the folder to make the display template available via a URL.
Once published, documents of the specified schema will be displayed using the template defined in the .hash file.
Creating display templates allows you to customize how your data is presented. Using JavaScript, you can create dynamic and interactive displays, ensuring your documents are both efficiently stored and meaningfully presented.
Publishing folders and making them accessible via URLs allows you to easily share your data. Whether for internal use or public access, display templates provide a seamless way to present your documents on the web.
In summary, display templates are a powerful feature of our SaaS document database. They enable customized views of your data, making it easier to understand and use. By following the steps above, you can create and publish display templates that enhance the value of your data.
Why Use Display Templates?
Display templates transform raw data into meaningful information. They present data in a structured and visually appealing manner, making it easier for users to interpret and interact with the information. Customizing the display of your documents highlights important details, provides context, and improves the overall user experience.
Advanced Customization
With display templates, you can go beyond basic data presentation. Incorporate conditional logic, loops, and other programming constructs to create highly dynamic and responsive displays. This level of customization ensures your data presentation adapts to various use cases and user needs.
Security and Access Control
When publishing folders and making them accessible via URLs, consider security and access control. Our SaaS platform provides robust security features to protect your data. Define access rules and permissions to control who can view or edit the documents and templates, ensuring sensitive information is only accessible to authorized users.