Name: the-mulberry-tree
Owner: TABLEFLIP
Description: :robot: Website for The Mulberry Tree
Created: 2016-06-23 18:53:20.0
Updated: 2018-04-18 08:55:28.0
Pushed: 2018-04-18 08:56:14.0
Homepage: http://mulberrytreemarketing.co.uk
Size: 812
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Website for The Mulberry Tree.
With node and npm installed:
install
start
This project use npm scripts to build the site to the dist
directory.
npm start
- Build site, watch for changes and run a hot code reloading server on http://localhost:3000Any module dropped into the helpers folder will be passed in the locals to all templates, with the obvious camel-case conversion (i.e. is-equal
would be available as isEqual
).
Fields in a content.json or facts.json which do not have a declared type
in the corresponding schema.json are assumed to be of type text. The available types are:
If validation beyond that which is built in for these fields is required, it can be supplied in a validation
key in the schema.json:
xampleField": {
"type": "text",
"validation": {
"format": "uri"
}
Available validation options are as per JSON-schema and can be found here.
JSON-schema regex patterns only allow a subset of those available in Javascript - for example, periods will match the period character rather than any character. Full details can be found under the pattern section here.
A collection (array of objects) is declared in the appropriate schema.json as a one-element array containing the declaration object rather than the object itself. Within this single object, declarations are as they would be for any other field. For example:
arousel": [{
"title": {
"type": "text",
"default": "New entry"
},
"image": {
"type": "img",
"default": "http://placehold.it/350x150"
},
"link": {
"type": "url",
"default": "http://example.com"
}
Note that in a collection every field requires a default
to be set for the client to be able to add new items.
Collections can be used to define subpages, so that the build process will provide a separate page in the same folder as the parent page for each item in a collection. To achieve this, you need to add the following key to the package.json:
Pages": {
y-page": {
"field": "subPages",
"slugFrom": "title",
"template": "subpage"
Each key in subPages should correspond to the page which contains the collection in question and under which the sub-pages will live.
title
or name
)..jade
to the template name here.The parent page template will receive the same content it would have otherwise, but each entry in the given collection will have _slug
and _index
values attached to it for easy routing.
For the child page template (either index.jade or the supplied alternative), the contents local is exactly as per the parent, but with an additional _entry
field containing the contents of the specific entry (including _slug
and _index
).