How It Works
The slug matches the path you see in the browser. For example, if you go todomain.com/about, the slug is about. The framework takes this slug and asks Littlebox Strapi Suite for the page details.
Check the backend documentation to learn how to create and manage slugs in the admin panel.
Dynamic Routing
The filesrc/app/(pages)/[...slug]/page.tsx handles these requests. It acts as the main entry point for your dynamic pages. Here is what it does:
- Gets the Slug: It reads the slug from the URL.
- Gets Data: It fetches the page content from Strapi using the
getPagefunction. - Shows the Page: It loads and displays the template that matches with page attributes.
Templates
Thetemplate field in Littlebox Strapi Suite tells the framework how to display the page. The system looks for a matching folder in src/app/templates.
For a template named home, the system loads:
- Logic:
src/app/templates/home/content.tsruns a strategy function. You use this to handle data before the page loads. - View: The default export (often
index.tsx) inside the folder shows the visual part of the page.
SEO and Metadata
The framework handles SEO for you automatically. It usesgenerateMetadata to fetch the page data and create the necessary HTML tags.
It also adds structured data (JSON-LD) to help search engines understand your site:
- Breadcrumbs: Shows the path to the current page.
- Base JSON-LD: details about the page structure.
Data Fetching
ThegetPage function handles the connection to the API. It uses a cache to make your site faster.