contentful

Import posts and pages from Contenful CMS

To install, run nikola plugin -i contentful

What is this?

This plugin lets integrate Nikola with a Contentful site, thus allowing you to use a web UI to create and edit posts and pages.

How to Use it

  1. Setup your Contentful site:
  2. In the Content model, set up Post and Page as content types (API identifier must be post and page respectively)
  3. Both content types must have title, slug, date, content fields.
  4. Create the content field as “text” (NOT “rich text”) with Markdown appearance.
  5. Any other fields will be part of the post metadata (you might want tags there, for example)
  6. Install the plugin using nikola plugin -i contentful
  7. Obtain a access token and space ID from your Contentful space and put them in a contentful.json like this:
{
  "SPACE_ID": "t2gxqu19qu62",
  "ACCESS_TOKEN": "dd167cf8b111d9e17a46059d"
}
  1. In your conf.py, add contentful/posts/*.md to POSTS and contentful/pages/*.md to PAGES. See conf.py.sample for an example.
  2. Run nikola contentful.

At that point your pages and posts created in Contentful should be ready for you to use. Have fun!

Suggested Configuration:

# In order to use the Contentful CMS you need to add the contentful/posts and contentful/pages
# folders to your POSTS and PAGES settings

POSTS = (
...
    ("contentful/posts/*.md", "posts", "post.tmpl"),
)
PAGES = (
...
    ("contentful/pages/*.md", "pages", "page.tmpl"),
)

Requirements:

  • contentful (Python package)
  • ruamel.yaml>=0.15 (Python package)

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.