A CLI tool that pulls data from Contentful and turns it into markdown files for Hugo and other static site generators. It also includes an express server that can be used for local development and content previews
Bot releases are visible (Hide)
Published by joshmossas over 3 years ago
Fix cannot access "sys" of "undefined"
error that occurs when an entry is referencing another entry that has been deleted or is inaccessible.
Published by joshmossas over 3 years ago
Static content is a new feature that allows you to specify a "static content" directory. Any content or data files in that directory will be copied into your content and / or data directory at build time. This creates a separate folder for managing content and data files that are not managed in Contentful making it easy to clean those folders (since now you can just delete the whole directory).
Example Config
// contentful-hugo.config.js
module.exports = {
// rest of config
staticContent = [
{
// all files in "./static_content" will be copied to "./content"
inputDir: "static_content",
ouputDir: "content"
},
{
// all files in "./static_data" will be copied to "./data"
inputDir: "static_data",
outputDir: "data"
}
]
}
When in running contentful-hugo --server
the server will also listen for changes in these static directories and copy updates to the output directories.
--clean
was added as a flag. Running contentful-hugo --clean
will find all root directories of the directories specified in the singleTypes
and repeatableTypes
and delete them. (Ex. if posts specifies "content/post" as the directory then "./content" will get deleted)Published by joshmossas over 3 years ago
Bugfix
layouts/shortcodes/contentful-hugo/entry-hyperlink.html
was missing entryId so a RelPermalink wasn't being rendered.<!-- before -->
<a href="{{ with .Site.GetPage }}{{ .RelPermalink }}{{ end }}">{{ $linkText }}</a>
<!-- after -->
<a href="{{ with .Site.GetPage $entryId }}{{ .RelPermalink }}{{ end }}">{{ $linkText }}</a>
Published by joshmossas over 3 years ago
Fix bug from v1.15.1
where non-date string fields were getting converted to ISO date strings
Published by joshmossas over 3 years ago
All date fields with time information now get converted to ISO format. Before this only occurred on fields named "date". This should prevent unable to parse date
errors in Hugo.
Published by joshmossas over 3 years ago
This release closes #39.
The field fileName
has been added to repeatable type options. It allows you to dictate the filename based on a Contenful entry property. By default files will be named after the entryId, but now you can override it to something like fields.slug
or fields.title
. In cases where the specified properties don't exist then the entryId will be used as a fallback.
Ex:
// contentful-hugo.config.js
module.exports = {
// rest of config
repeatableTypes: [
{
id: "post",
directory: "content/post",
fileName: "fields.slug"
}
]
}
Also in this version contentful-hugo will now generate a directory named .contentful-hugo
. This is a temporary directory that is used to store rendered file data. For right now it is only being used to track where files were written to so that old copies can be deleted should the filename change. This directory should be added to gitignore.
Published by joshmossas over 3 years ago
This released adds a locales
field to the config file, which enables developers to specify multiple locales to pull content from.
Usage instructions can be found here: https://github.com/ModiiMedia/contentful-hugo#localization-options
This release adds the --server
flag which fires up a NodeJS server that can receive Contentful webhooks and overwrite / delete the affected files. By default the server runs on port 1414 but can be overwritten with the --port
flag.
This release also adds a default sys
field to content markdown
sys:
id: "<entry-id>"
updatedAt: "<updated-at-date>"
createdAt: "<created-at-date>"
revision: <revision-number>
space: "<space-id>"
contentType: "<content-type-id>"
The following fields are now marked as depreciated and will be removed in a future release:
sys.updatedAt
)sys.createdAt
)