# Contentful Setup

# Introduction

Using Contentful is a powerful way for managing your content on your Nacelle space. In order to use Contentful for managing your pages, blogs, and articles you must configure specific content models for that data. There are 10 default content types that have built-in support for Nacelle: Article, Blog, Author, Page, Content, Hero Banner, Side by Side, Product Grid, Testimonial, and Testimonials.

# Automatically Upload Content Model Schema

The required models can be automatically loaded for you using the Contentful CLI (opens new window). Download our Nacelle configuration file here (opens new window), which you will use to import the default content types.

After installing the CLI and authenticating with your space, run the import command to set up the content models on your space. Directions for importing can be found in Contentful's documentation here (opens new window). The command in your terminal should look something like this:

contentful space import --space-id [your space id] --content-file [path to downloaded contentful-contentTypes.json]

# Configure Contentful in the Nacelle dashboard

Upon completing your schema upload you will need to update your content settings in your Nacelle dashboard. First, in your Contentful space settings find or generate a new access token under "API Keys". These are the settings you will need to fill out in your Nacelle Dashboard.

Next, log in to the Nacelle dashboard and select your space. Scroll down to the Content Settings section and change the Connector Type drop down menu to "Contentful". Add your Contentful space id, the environment, and the Content Delivery API access token.

When all the fields are complete, you can click the button for "Save Changes and Index Content". This will start the importing and indexing process to pass your data from Contentful to Nacelle.

# With Nuxt

The following instructions detail using Contentful as a content data source with the Nacelle Nuxt Starter.

# Begin Adding Content

# Create a Homepage

Once you have added all the necessary content models you can begin adding your homepage content. First, create a new entry with content type of "Page". Set the title and handle to "Homepage" and "homepage". Pages have a WYSIWYG field, "Body", for adding basic text and image content. They also have the field "Sections" you can add your content section blocks for more expressive content.

WARNING

Content handles must be unique to their content type. For example if you create a page and set the handle to "about-us". No other page content type should have the same handle. Nacelle uses handles for generating unique ids when indexing your content.

Entries in Contentful must have a handle in order to be indexed.

"Hero Banner", "Side by Side", "Product Grid", and "Testimonials" are default section block content types. They are preconfigured to work with several components in our Nuxt Starter. Additionally there is also the "Testimonial" content type which is used in the Testimonial component.

If these default content types do not fully suit your needs, you can create new section block content types or extend our default content types with new fields. When making this kind of customization, however, you will need to create your own custom frontend components to handle this data.

After updating the "Homepage" fields, save and publish. You will then need to re-index this and all other content changes from the Nacelle dashboard.

# Create a Blog

You can also create a new blog easily with our default components. Create a new entry of content type "Blog" in Contentful. Blogs have a field for title, handle, and articles. Under "Articles", clicking "Create a new entry and link" and selecting "Article", will bring up the form to write your first blog article. Save and publish the article as well as the newly created blog. Again re-index your content to ensure Nacelle has your latest updates and you are all set.