1.1.1 • Published 4 years ago
@zladuric/wintersmith-gallery v1.1.1
Wintersmith Gallery Plugin
This plugin lets you publish directories with images in them.
It then creates galleries index page with links to individual galleries (directories) and those individual galleries as one page for each directory containing accepted images.
Usage
- Install the plugin
- Add it to config
- Add the templates and JavaScript
1. Install the plugin
npm i @zladuric/wintersmith-gallery
2. Add it to config
Include the plugin in config.json:
"plugins": [
"@zladuric/wintersmith-gallery"
],
3. Add the templates and JavaScript
Create the templates and styling and things.
Example:
- Index page for all your galleries,
- Individual gallery page,
- Add some styling and
- a simple lightbox
That's it. if you drop a directory full of images under contents/galleries
and wintersmith build
the site, you'll have
a bunch of new pages with your images.
Configuration
You should configure the plugin in config.json:
{
"template": "gallery.pug",
"indexTemplate": "galleries-index.pug",
"galleries": "galleries",
"validImageTypes": ["png", "jpg", "jpeg"], // which types of templates are valid for inclusion
"galleriesIndex": "galleries/index.html",
"galleryPageIndex": "==GALLERY==/index.html"
"perPage": 10,
"galleriesRootMandatory": true
}
Options (option name
default: description):
template
galery.pug: template for individual gallery, exampleindexTemplate
galleries-index.pug: template for index page with links to all galleries, examplegalleries
galleries: where undercontents
to look for galleries directoriesvalidImageTypes
["png", "jpg", "jpeg"]: which types of templates are valid for inclusion. Note: only checked by file extension.galleriesIndex
galleries/index.html": filename for the index pagegalleryPageIndex
==GALLERY==/index.html: filename for the individual gallery. Note: MUST include the string ==GALLERY==.galleriesRootMandatory
true: fail the build if there's no root directory for galleries.