app/templates and renders its index.tsx file.
Check the backend documentation to learn how to create and manage
templates in the admin panel.
The Default Template
Thedefault template is the most versatile option. Instead of enforcing a fixed layout, it dynamically renders the blocks (components) defined in your Strapi content.
You typically use this template for landing pages, about pages, or any page constructed from flexible content blocks.
How It Works
Openapp/templates/default/index.tsx to see the implementation. The component receives a page prop containing all the data from Strapi. It iterates over the blocks array and renders the specific component for each block type.
Content Injection
You often need to include data that doesn’t come directly from the page’s main fields in Strapi. The framework solves this with Content Injection. You perform content injection using acontent.ts file located within your specific template folder (e.g., app/templates/default/content.ts).
Purpose
Use content injection to:- Fetch External Data: Load data from third-party APIs or other services.
- Compute Values: Calculate values server-side before the page renders.
- Enrich the Page Object: Add extra properties to the
pageobject that your components need.
How to Use
Create acontent.ts file in your template directory. Export a default asynchronous function that receives the Page object. Any changes you make to this object persist when the framework passes it to your template component.