Prerequisites
Before starting the tutorial, make sure to follow these steps:- Littlebox Strapi Suite Plugin: have the plugin installed and configured as described in the backend documentation.
- Littlebox Strapi Suite Frontend: have the frontend installed and configured as described in the frontend documentation.
Tutorial
Introduction
In this tutorial, you build your own app integrated with Strapi. This is a great way to experience a typical development workflow while learning key concepts, tools, and terminology used when building apps with Next.js and Strapi. Strapi lets you build different data structures based on your project’s needs. For demonstration purposes, you’ll create a collection type calledPages, where fields like title, slug, and seo are shared across all documents
in that collection. Each section within a page will be a component that you can add or remove depending on the specific
content of each page.
You can also create each page as a single type, depending on how you want to organize your data.
However, for this tutorial and better understanding, we recommend following our approach.
Any document can be treated as a page, as long as it includes the following specifications:
- The fields
title,slug, andseoproperly configured. - The template where the document data will be injected.
1. Set up the homepage
Access the Strapi admin panel athttp://localhost:1337 (this may vary depending on your local setup). Go to the Content-Type Builder
and create a new collection called Pages as shown in the image below.

Advanced Settings tab, also enable Internationalization, we’ll cover this topic in more detail later.

Pages under Collection Types, then click on Create new entry.
Enter the title. Notice that the slug field fills in automatically. However, this won’t be the slug for the
homepage, we’ll update this setting later in the tutorial. In the right-hand sidebar, under the Page Attributes section,
select the default template.
After you fill in the fields, click Save, then click Publish.

Settings under the Slug section. At the top right of the
page, click Settings again. In the HOME PAGE field, select the document you created in the previous step.
In the HOME PAGE SLUG STRATEGY field, choose the Language option. Read the documentation
for a better understanding of the selected options.

HOMEPAGE tag appears next to the selected document. This indicates that the document has been set as the homepage.

npm run dev to start the development server. Visit http://localhost:3000 to view your application.

2. Integrate fields into the template
All fields added to the document are injected into the template through thepage property.
For better understanding, open the file src/templates/default/index.tsx, which corresponds to the template selected in the previous step.
Notice that the page property is injected into the template, containing all the properties of the document.
Step 2: Go to the Content-Type Builder -> Pages.
Step 3: Click “Add another field to this collection type”.
Step 4: Select the
Rich text (Markdown) type.Step 5: Enter “description” as the name.

Advanced settings tab, check Required field and Enable localization for this field.

Step 9: Enter “Littlebox Suite helped me build websites faster.” in the
description field.Step 10: Click “Save”, then “Publish”.
Step 11: Open the default template located in the
src/templates/default/index.tsx folder.Step 12: Replace the current code with the following code:
http://localhost:3000 to view the result.For more information on how to retrieve data in the template, read the template documentation section.

3. Create components and dynamic zones
The approach in the previous step was meant to show the easiest way to edit content on the frontend from the admin panel. However, when you create new pages, the defined fields are the same for all of them. This is not a good practice, since the data architecture is defined at the collection level, not at the page level. To solve this issue, a good practice is to use components and dynamic zones. For more information on components and dynamic zones, visit the official Strapi documentation. Step 1: Access the Strapi admin panel.Step 2: Go to the Content-Type Builder -> Pages.
Step 3: Delete the
description field and click “Save”.Step 4: In the sidebar menu, click “Create new component”.
Step 5: In the
Basic settings tab, fill in the following values and click “Continue”.

Rich text (Markdown).Step 7: In the
Basic settings tab, fill in the following values and click “Finish”.

Step 9: Still in the Content-Type Builder, click “Pages” under the
Collection Types section.Step 10: Click “Add another field to this collection type”.
Step 11: Select
Dynamic zone, fill in the following values, and click “Add components to the zone”.


Use an existing component, select the text component, then click “Finish” and “Save”.

Step 14: Click “Add component to components” and select the
Text component.


Step 16: Open the default template located in the
src/templates/default/index.tsx folder.Step 17: Replace the current code with the following code:
4. Create new templates
For better understanding, this section uses a news system as an example, with one page for the news list and another for the news details. The first step is to create the necessary templates for this system, both in the Strapi admin panel and on the frontend. Step 1: Access the Strapi admin panel.Step 2: Go to the Littlebox Strapi Suite.
Step 3: Click “Template”.
Step 4: Click “Create new entry”.


Step 7: Fill in the fields with the following information:


Slug



Text


Rich text (Markdown)


Media


Component



Step 10: Click “Create new component”.


Step 12: Still in the Content-Type Builder, edit the
Pages collection.
Step 13: In the field list, under components, click “Add a component”.


Step 15: Go to the Content Manager -> post.
Step 16: Click “Create new entry” and fill in the fields.
Step 17: In the right-side panel, under the
PAGE ATTRIBUTES section, select the News - Details template.Step 18: Click “Save” and “Publish”.
Add at least 2 posts to help you follow the tutorial.
Step 20: Click “Create new entry” and fill in the following values:

PAGE ATTRIBUTES section, select the News template.Step 22: Click “Save” and “Publish”.
Step 23: Create the
index.tsx file inside the src/templates/news folder and add the following code:

index.tsx file inside the src/templates/news-details folder and add the following code:

Step 26: In the right-side panel, under the
PAGE ATTRIBUTES section, select the News page as the parent.Step 27: Click “Save” and “Publish”. Do the same for all posts. Visit http://localhost:3000/news and click one of the posts to see the result.
Notice that the post’s URI now includes the parent page.