Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

contentful-hugo

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentful-hugo - npm Package Compare versions

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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc