Skip to content

Gulp plugin to split Stratic index pages into pages

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

straticjs/stratic-paginate-indexes

stratic-paginate-indexes

Gulp plugin to split Stratic index pages into pages

Installation

npm install stratic-paginate-indexes

Usage

Usage is quite simple. All you need to do is pipe Stratic indexes to this module and presto! You're done.

Minimal gulpfile.js for this module to work:

var gulp = require('gulp');
var frontMatter = require('gulp-gray-matter');
var straticDateInPath = require('stratic-date-in-path');
var addsrc = require('gulp-add-src');
var straticPostsToIndex = require('stratic-posts-to-index');
var straticPaginateIndexes = require('stratic-paginate-indexes');

gulp.task('post-index', function() {
    gulp.src('*.md')
        .pipe(frontMatter())
        .pipe(straticDateInPath())
        .pipe(addsrc('src/blog/index.jade'))
        .pipe(straticPostsToIndex('index.jade'))
        .pipe(straticPaginateIndexes());
});

Complete example gulpfile.js:

var gulp = require('gulp');
var frontMatter = require('gulp-gray-matter');
var remark = require('gulp-remark');
var remarkHtml = require('remark-html');
var straticDateInPath = require('stratic-date-in-path');
var addsrc = require('gulp-add-src');
var straticPostsToIndex = require('stratic-posts-to-index');
var straticPaginateIndexes = require('stratic-paginate-indexes');
var jade = require('gulp-jade');
var rename = require('gulp-rename');

gulp.task('post-index', function() {
    gulp.src('*.md')
        .pipe(frontMatter())
        .pipe(remark().use(remarkHtml))
        .pipe(straticDateInPath())
        .pipe(addsrc('src/blog/index.jade'))
        .pipe(straticPostsToIndex('index.jade'))
        .pipe(straticPaginateIndexes())
        .pipe(jade({pretty: true, basedir: __dirname}))
        .pipe(rename({ extname: '.html' }))
        .pipe(gulp.dest('dist/blog'));
});

Locals

Two additional locals are provided to templates via the file.data attribute. page indicates which page number the file represents. pageCount represents how many total pages there are for that particular index.

License

LGPL 3.0+

Author

AJ Jordan [email protected]

About

Gulp plugin to split Stratic index pages into pages

Topics

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Code of conduct

Stars

Watchers

Forks

Packages

No packages published