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.2 to 1.0.3

8

index.js

@@ -22,4 +22,4 @@ const contentful = require('contentful');

let config = yaml.safeLoad(fs.readFileSync('contentful-settings.yaml'));
// loop through contentTypes
let types = config.contentTypes
// loop through repeatable content types
let types = config.repeatableTypes
for(let i = 0; i < types.length; i++){

@@ -50,4 +50,4 @@ // object to pass settings into the function

}
// loop through single instances
let singles = config.singleInstances
// loop through single content types
let singles = config.singleTypes
for (let i = 0; i < singles.length; i++){

@@ -54,0 +54,0 @@ let single = singles[i]

{
"name": "contentful-hugo",
"version": "1.0.2",
"version": "1.0.3",
"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.",

@@ -29,3 +29,8 @@ "main": "index.js",

},
"files": ["cli.js", "./images/*", "readme.md", "index.js"]
"files": [
"cli.js",
"./images/*",
"readme.md",
"index.js"
]
}

@@ -10,2 +10,5 @@ # Contentful Hugo

# Installation
```
npm install contentful-hugo
```

@@ -23,3 +26,3 @@ # Usage

![Config file not found]("https://raw.githubusercontent.com/ModiiMedia/contentful-hugo/master/images/config-file-not-found.jpg")
![Config file not found](https://raw.githubusercontent.com/ModiiMedia/contentful-hugo/master/images/config-file-not-found.jpg)

@@ -43,23 +46,21 @@ # Configuration

Example **contentful-settings.yaml** file (see below for complete configuration options)
```yaml
# Single instance types.
# For these content types contentful-hugo will only pull the most recent entry of a content type. Useful for things like homepages and settings
singleInstances:
- id: homepage # content type id (required)
directory: /content/ # destination directory (required)
fileName: _index # filename (required)
fileExtension: md # can be "md", "yaml", or "yml". It defaults to "md"
- id: homepage
directory: /content/
fileName: _index
fileExtension: md
- id: siteSettings
directory: /data/ # example of a single instance being used for a data file instead of a content file
directory: /data/
fileName: settings
fileExtension: yaml
# repeated content types
contentTypes:
- id: posts # content type ID (required)
directory: /content/posts/ # destination directory (required)
fileExtension: # This can be "md", "yaml", or "yml". It defaults to "md" if not set.
mainContent: content # field you want to map as main content (optional. Does not work with rich-text fields. See below)
isHeadless: false # makes content type a headless bundle (see hugo docs)
- id: posts
directory: /content/posts/
fileExtension: md
mainContent: content

@@ -78,1 +79,10 @@ - id: seoFields

```
| field | required | description |
| ------ | -------- | ------------ |
| id | required | contentful content type ID goes here |
| 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)
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