contentful-hugo
Advanced tools
Comparing version 1.0.3 to 1.1.0
50
index.js
@@ -163,25 +163,29 @@ const contentful = require('contentful'); | ||
else { | ||
frontMatter[field] = [] | ||
for(let i = 0; i < fieldContent.length; i++) { | ||
let arrayNode = fieldContent[i]; | ||
switch(typeof(arrayNode)){ | ||
case 'object': | ||
let arrayObject = {} | ||
switch(arrayNode.sys.type){ | ||
case 'Asset': | ||
getAssetFields(arrayNode, arrayObject) | ||
frontMatter[field].push(arrayObject) | ||
break; | ||
case 'Entry': | ||
getEntryFields(arrayNode, arrayObject) | ||
frontMatter[field].push(arrayObject); | ||
break; | ||
default: | ||
frontMatter[field].push(arrayNode); | ||
break; | ||
} | ||
break; | ||
default: | ||
frontMatter[field].push(arrayNode); | ||
break; | ||
if (!fieldContent.length) { | ||
frontMatter[field] = fieldContent | ||
} else { | ||
frontMatter[field] = [] | ||
for(let i = 0; i < fieldContent.length; i++) { | ||
let arrayNode = fieldContent[i]; | ||
switch(typeof(arrayNode)){ | ||
case 'object': | ||
let arrayObject = {} | ||
switch(arrayNode.sys.type){ | ||
case 'Asset': | ||
getAssetFields(arrayNode, arrayObject) | ||
frontMatter[field].push(arrayObject) | ||
break; | ||
case 'Entry': | ||
getEntryFields(arrayNode, arrayObject) | ||
frontMatter[field].push(arrayObject); | ||
break; | ||
default: | ||
frontMatter[field].push(arrayNode); | ||
break; | ||
} | ||
break; | ||
default: | ||
frontMatter[field].push(arrayNode); | ||
break; | ||
} | ||
} | ||
@@ -188,0 +192,0 @@ } |
{ | ||
"name": "contentful-hugo", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Node module that pulls data from Contentful and turns it into markdown files for Hugo. Can be used with other Static Site Generators, but has some Hugo specific features.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,11 @@ # Contentful Hugo | ||
**Table of Contents** | ||
- [Prerequisites](#Prerequisites) | ||
- [Installation](#Installation) | ||
- [Usage](#Usage) | ||
- [Configuration](#Configuration) | ||
- [Field Compatibility](#Field-Compatibility) | ||
# Prerequisites | ||
@@ -48,3 +57,3 @@ | ||
```yaml | ||
singleInstances: | ||
singleTypes: # fetches only the most recently updated entry in a particular content type | ||
- id: homepage | ||
@@ -60,3 +69,3 @@ directory: /content/ | ||
contentTypes: | ||
repeatableTypes: # feteches all the entrys of a content type and places them in a directory | ||
- id: posts | ||
@@ -80,2 +89,4 @@ directory: /content/posts/ | ||
**Configuration Options** | ||
| field | required | description | | ||
@@ -85,5 +96,12 @@ | ------ | -------- | ------------ | | ||
| directory | required | directory where you want the file(s) to be generated (leading and trailing slashes required for the time being) | | ||
| fileName | required (single instances only) | name of the file generated | | ||
| fileExtension | optional | can be "md", "yml", or "yaml" (defaults to "md") | | ||
| isHeadless | optional (repeated instances only) | turns content type into a headless bundle (see hugo docs) | | ||
| mainContent | optional | field ID for field you want to be the main Markdown content. (Does not work with rich text fields) | ||
| fileName | required (single types only) | name of the file generated | | ||
| fileExtension | optional (repeatable types only) | can be "md", "yml", or "yaml" (defaults to "md") | | ||
| isHeadless | optional (repeated instances only) | turns all entries in a content type into headless leaf bundles (see [hugo docs](https://gohugo.io/content-management/page-bundles/#headless-bundle)) | | ||
| mainContent | optional | field ID for field you want to be the main Markdown content. (Does not work with rich text fields) | ||
# Compatibility Issues | ||
These are know compatibility issues. | ||
- Hugo cannot parse date field if field is set to "date and time without timezone" | ||
- Rich Text Fields give errors when using "inline-entry" "link-to-asset" "link-to-entry". Please disable these for the time being. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19243
313
102