Skip to content

Commit

Permalink
Improve README and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
regisphilibert committed May 19, 2020
1 parent a559d07 commit ac83849
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# TND Netlify CMS Hugo Module

This module, in its phase 1, tends to simplify the construct of Netlify CMS lone config file and set up the Netlify CMS page wherever on the project.
This module try to simplify the construct of Netlify CMS lone config file. It also sets up the Netlify CMS page wherever on the project with minimal user intervention.

By using Hugo's Data files system to store and maintain reusable data objects which can be imported in the Netlify CMS configuration file as collections or fields, the module ease up on maintaining this wall of glyph that can quickly become your favorite CMS' `config.yml`
In order to be able to reuse data objects inside the lone NetlifyCMS `config.yaml` file, this module makes use of Hugo's data file to store said data objects and allow them to be recursively imported in the configuration file.

## The Import statement
```
Expand All @@ -11,6 +11,13 @@ import collection posts
```
## Adding to your project


1. Add this module's path to your `module.imports` config array
```
module:
imports:
- path: github.com/theNewDynamic/hugo-module-tnd-netlify-cms
```
1. Create a page where your Netlify CMS dasboard should live.
2. Add the `netlifycms` layout to it through Front Matter.
3. Add the `netlifycms_config` output format to it through Front Matter (alongside HTML):
Expand Down Expand Up @@ -77,4 +84,4 @@ fields:
label: "Title"
name: "title"
widget: "string"
```
```
4 changes: 3 additions & 1 deletion func/private/GetConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

@context Any

@access public
@return Map

@access private

@example - Go Template
{{ with partial "tnd-netlifycms/private/GetConfig" . }}
Expand Down
3 changes: 3 additions & 0 deletions func/private/go.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

@access private

@use
- private/GetConfig

@example - Go Template
{{- with partial "tnd-netlifycms/private/go" . -}}
{{ . }}
Expand Down
10 changes: 5 additions & 5 deletions func/private/import.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{{/*
import
Reads a data object, look for an import statement and returns the correspondig data if present in data files. If not import found
returns the context data as is.
Reads a data object, look for an import statement and returns the correspondig data if present in data files.
If no import found returns the context data as is.

@author @regisphilibert

@context Any (.)

@return Any (.)

@access public
@access private

@example - Go Template
{{ partial "path" context }}
{{ partialCached "path" context "variant" }}
{{ with partialCached "tnd-netlifycms/private/import" . . }}
{{ end }}
*/}}
{{/* regex101.com > https://regex101.com/r/TFA6WQ/1 */}}
{{ $pattern := "^import ([a-zA-Z]*) ([a-zA-Z/_-]*)$" }}
Expand Down

0 comments on commit ac83849

Please sign in to comment.