What we will do:
This guide will provide you with a foundation for creating, publishing and showcasing your content using Nimvio. With the help of this introductory tutorial, you will construct a basic website powered by Nimvio, right from the beginning to the end. For those who are new to headless CMSs, this is an excellent starting point.
If you haven't yet created a Nimvio account, visit https://www.app.nimvio.com/sign-up/ to sign up for a free account. Afterwards, go to https://app.nimvio.com/ and sign in.
If you encounter any difficulties during the sign-up process, you can refer to the Get Started to Nimvo guide for assistance.
In Nimvio, you have the option to start your project either from scratch or by selecting a theme. Click the +New Project button to create a new Nimvio project.
Select the "Start from Scratch" option to initiate a project and provide a name for your new project.
Content templates define the structure of a piece of content – a content item. They are made of content elements such as texts and images. As its name suggests, it provides a template for content that can be re-used in the future.
A content template can be applied to a single content item, such as a homepage, or multiple content items, such as articles that share a common Article content template.
Now it's time to create a content template for a homepage, which should consist of a headline, some text, and an image.
Congratulations! Your content template is now available for use.
To view the created content template, click on the pencil icon located in the content template table.
You can now create a content item based on the new Homepage content template. A content item is an instance of a content template.
Each content item can be accessed at a specific URL similar to this one:
https://api.nimvio.com/cda/rest/v1/<ENVIRONMENT_ID>/contents
The REST API URL for published content is available on the information sidebar panel in the right.
You can alson construct the URL manually by following the below steps:
<ENVIRONMENT_ID>
with the ID of your project:
For example, the URL can look like this:
https://api.nimvio.com/cda/rest/v1/Project_2eb07e5e-2e66-4cba-3369-d8d597fb7e81/contents
The API will return your content item as a structured JSON object that is easy to parse by any programming language.
In this part of the guide, you will learn how to use JavaScript to display the content from a JSON object onto a web page. The JSON response contains the three elements as objects which are specified by their field name: headline
, bodyText
, and picture
.
First, you will create an HTML file and declare which HTML elements you want to populate. The order of elements in the HTML file is the order in which the content will appear on the website. Create a new, blank text file and name it index.html
.
Insert the following code into the HTML file:
Let’s populate the <h1>
, <img>,
and <p>
elements in the HTML file with content from Nimvio:
headline
with the value “Hello World!” goes into the <h1>
element, bodyText
with the paragraph below the logo goes into the <p>
element, picture
, the value of which is the logo URL, goes into the <img>
element.Now, create a file named main.js
and insert the following code:
Fantastic! You have finished the journey to create your website from scratch in Nimvio. To preview your website, simply open the index.html file that you created before. When you merge the two code examples and add a bit of CSS, the result will appear as shown in the image below.
Congratulations! You have arrived at the end of your website building journey. To learn on how to deploy and host your website, please refer to the following guide on Website Provisioning Outside Nimvio. Keep exploring others below: