find-posts
v0.5.0
Published
Find posts recursively within a subdirectory, and parse their front matter
Downloads
11
Maintainers
Readme
find-posts
Finds and parses posts in specific directories with specific names.
Installation
npm i --save find-posts
Usage
const findAllPosts = require('find-posts/find-all-posts.js');
findAllPosts({
dirs: [
{
path: path.resolve(cwd, './posts/foo/'),
regexes: [ /^(\d\d\d\d)-(\d\d)-(\d\d)-(.*)\.html\.md$/; ],
},
{
path: path.resolve(cwd, './posts/bar/'),
regexes: [ /^(.+)\.html$/ ],
}
],
})
.then((data) => {
// look in data for posts
});
A post is any file whose name matches the specified pattern,
found within the speicified directory,
and contains front matter that is parseable by
front-matter
.
Author
Licence
GPL-3.0