diff --git a/ressources/blog/_blocks/block-1.md b/ressources/blog/_blocks/block-1.md new file mode 100644 index 0000000..e149f96 --- /dev/null +++ b/ressources/blog/_blocks/block-1.md @@ -0,0 +1,14 @@ +--- +title: "health goth DIY tattooed" +--- +## Normcore cold-pressed ramps DSA + +Normcore cold-pressed ramps DSA yes plz hot chicken green juice succulents leggings messenger bag truffaut iceland pabst ethical godard. Semiotics air plant marfa, drinking vinegar authentic iceland pug fit cloud bread cronut kickstarter glossier crucifix tumeric. Chicharrones polaroid flexitarian, seitan lumbersexual viral fam master cleanse four dollar toast scenester. Succulents poutine vegan keffiyeh meh, health goth DIY tattooed. Praxis roof party celiac chartreuse banjo butcher you probably haven't heard of them schlitz beard. Ethical tattooed kinfolk, cliche vegan messenger bag mukbang dreamcatcher cloud bread farm-to-table gatekeep trust fund. + +## Palo santo leggings normcore aesthetic + +bicycle rights sartorial godard slow-carb thundercats art party cray JOMO. Truffaut four dollar toast hoodie pour-over. Fanny pack iPhone jean shorts tote bag, master cleanse succulents tbh fixie gatekeep pok pok letterpress cornhole. Dreamcatcher tattooed hot chicken gatekeep, glossier salvia 8-bit cred. Fit lomo chillwave cold-pressed humblebrag narwhal. Meggings edison bulb fanny pack irony af pug pok pok whatever vexillologist vibecession cred butcher trust fund chia. + +## Bitters kale chips chambray activated charcoal + +wolf keffiyeh hell of selfies. Wolf readymade shoreditch flexitarian venmo single-origin coffee, knausgaard fit actually street art cold-pressed iPhone gatekeep. Migas bruh adaptogen semiotics marfa pickled yuccie. Locavore normcore lomo, shoreditch fashion axe actually glossier iPhone photo booth blue bottle DIY XOXO williamsburg. Pinterest whatever taxidermy, kale chips prism XOXO schlitz twee tote bag woke swag. Wayfarers fashion axe heirloom humblebrag synth. Whatever succulents PBR&B, pop-up enamel pin echo park tonx stumptown taiyaki. diff --git a/ressources/blog/_blocks/block-2.md b/ressources/blog/_blocks/block-2.md new file mode 100644 index 0000000..e149f96 --- /dev/null +++ b/ressources/blog/_blocks/block-2.md @@ -0,0 +1,14 @@ +--- +title: "health goth DIY tattooed" +--- +## Normcore cold-pressed ramps DSA + +Normcore cold-pressed ramps DSA yes plz hot chicken green juice succulents leggings messenger bag truffaut iceland pabst ethical godard. Semiotics air plant marfa, drinking vinegar authentic iceland pug fit cloud bread cronut kickstarter glossier crucifix tumeric. Chicharrones polaroid flexitarian, seitan lumbersexual viral fam master cleanse four dollar toast scenester. Succulents poutine vegan keffiyeh meh, health goth DIY tattooed. Praxis roof party celiac chartreuse banjo butcher you probably haven't heard of them schlitz beard. Ethical tattooed kinfolk, cliche vegan messenger bag mukbang dreamcatcher cloud bread farm-to-table gatekeep trust fund. + +## Palo santo leggings normcore aesthetic + +bicycle rights sartorial godard slow-carb thundercats art party cray JOMO. Truffaut four dollar toast hoodie pour-over. Fanny pack iPhone jean shorts tote bag, master cleanse succulents tbh fixie gatekeep pok pok letterpress cornhole. Dreamcatcher tattooed hot chicken gatekeep, glossier salvia 8-bit cred. Fit lomo chillwave cold-pressed humblebrag narwhal. Meggings edison bulb fanny pack irony af pug pok pok whatever vexillologist vibecession cred butcher trust fund chia. + +## Bitters kale chips chambray activated charcoal + +wolf keffiyeh hell of selfies. Wolf readymade shoreditch flexitarian venmo single-origin coffee, knausgaard fit actually street art cold-pressed iPhone gatekeep. Migas bruh adaptogen semiotics marfa pickled yuccie. Locavore normcore lomo, shoreditch fashion axe actually glossier iPhone photo booth blue bottle DIY XOXO williamsburg. Pinterest whatever taxidermy, kale chips prism XOXO schlitz twee tote bag woke swag. Wayfarers fashion axe heirloom humblebrag synth. Whatever succulents PBR&B, pop-up enamel pin echo park tonx stumptown taiyaki. diff --git a/ressources/blog/_blocks/data.md b/ressources/blog/_blocks/data.md new file mode 100644 index 0000000..c8f8909 --- /dev/null +++ b/ressources/blog/_blocks/data.md @@ -0,0 +1,14 @@ +--- +title: "Data" +--- +## Normcore cold-pressed ramps DSA + +Normcore cold-pressed ramps DSA yes plz hot chicken green juice succulents leggings messenger bag truffaut iceland pabst ethical godard. Semiotics air plant marfa, drinking vinegar authentic iceland pug fit cloud bread cronut kickstarter glossier crucifix tumeric. Chicharrones polaroid flexitarian, seitan lumbersexual viral fam master cleanse four dollar toast scenester. Succulents poutine vegan keffiyeh meh, health goth DIY tattooed. Praxis roof party celiac chartreuse banjo butcher you probably haven't heard of them schlitz beard. Ethical tattooed kinfolk, cliche vegan messenger bag mukbang dreamcatcher cloud bread farm-to-table gatekeep trust fund. + +## Palo santo leggings normcore aesthetic + +bicycle rights sartorial godard slow-carb thundercats art party cray JOMO. Truffaut four dollar toast hoodie pour-over. Fanny pack iPhone jean shorts tote bag, master cleanse succulents tbh fixie gatekeep pok pok letterpress cornhole. Dreamcatcher tattooed hot chicken gatekeep, glossier salvia 8-bit cred. Fit lomo chillwave cold-pressed humblebrag narwhal. Meggings edison bulb fanny pack irony af pug pok pok whatever vexillologist vibecession cred butcher trust fund chia. + +## Bitters kale chips chambray activated charcoal + +wolf keffiyeh hell of selfies. Wolf readymade shoreditch flexitarian venmo single-origin coffee, knausgaard fit actually street art cold-pressed iPhone gatekeep. Migas bruh adaptogen semiotics marfa pickled yuccie. Locavore normcore lomo, shoreditch fashion axe actually glossier iPhone photo booth blue bottle DIY XOXO williamsburg. Pinterest whatever taxidermy, kale chips prism XOXO schlitz twee tote bag woke swag. Wayfarers fashion axe heirloom humblebrag synth. Whatever succulents PBR&B, pop-up enamel pin echo park tonx stumptown taiyaki. diff --git a/src/queries/blocks.js b/src/queries/blocks.js index cc2abee..d7f64df 100644 --- a/src/queries/blocks.js +++ b/src/queries/blocks.js @@ -21,12 +21,18 @@ class Blocks { * @param {string} dirPath * */ - constructor(dirPath) { + constructor(dirPath, filename) { this.FILE_EXTENSION = '.md' this.DIRECTORY_BLOCKS = '_blocks' - this._dirPath = dirPath + '/' + this.DIRECTORY_BLOCKS; + this._dirPath = dirPath + + if (filename !== 'index.md') { + this._dirPath += '/' + filename + } + + this._dirPath += '/' + this.DIRECTORY_BLOCKS; this._results = {} } diff --git a/src/queries/pages.js b/src/queries/pages.js index 7ad91ca..9876d5c 100644 --- a/src/queries/pages.js +++ b/src/queries/pages.js @@ -127,8 +127,8 @@ class Pages { return; } - // check if - const blocks = this._getBlocks(dirPath + options.parent + '/' + file.name) + // check for blocks + const blocks = this._getBlocks(dirPath + options.parent, file.name) // create page object and add to page const page = new PageFactory(file, options.parent, content, blocks) @@ -149,8 +149,8 @@ class Pages { * @return {array} * */ - _getBlocks(dirPath) { - const blocksQuery = new BlocksQuery(dirPath) + _getBlocks(dirPath, filename) { + const blocksQuery = new BlocksQuery(dirPath, filename) return blocksQuery.find() } diff --git a/test/blocks.js b/test/blocks.js index 1441e6c..04e76de 100644 --- a/test/blocks.js +++ b/test/blocks.js @@ -6,7 +6,7 @@ describe('Blocks / Array', function () { // get function parseMarkdownFile const BlocksQuery = require('./../src/queries/blocks.js') - const blocksQuery = new BlocksQuery('./ressources') + const blocksQuery = new BlocksQuery('./ressources', 'index.md') const results = blocksQuery.find() // check results @@ -28,7 +28,7 @@ describe('Blocks / Single', function () { // get function parseMarkdownFile const BlocksQuery = require('./../src/queries/blocks.js') - const blocksQuery = new BlocksQuery('./ressources') + const blocksQuery = new BlocksQuery('./ressources', 'index.md') const results = blocksQuery.find() // check results diff --git a/test/pages.js b/test/pages.js index 1d98621..217a567 100644 --- a/test/pages.js +++ b/test/pages.js @@ -10,10 +10,14 @@ describe('Page /index.md', function () { const page = results[2] - it('fields is object', function() { + it('fields is Object', function() { assert.isObject(page) }) + it('fields has Blocks', function() { + assert.equal(page.blocks.block.length, 2) + }) + it('path', function() { assert.equal(page.path, '/index.html') }) @@ -23,6 +27,30 @@ describe('Page /index.md', function () { }) }) +describe('Page /blog/index.md', function () { + + const query = new PagesQuery('./ressources'); + const results = query.find() + + const page = results[1] + + it('fields is object', function() { + assert.isObject(page) + }) + + it('fields has Blocks', function() { + assert.equal(page.blocks.block.length, 2) + }) + + it('path', function() { + assert.equal(page.path, '/blog.html') + }) + + it('permalink', function() { + assert.equal(page.permalink, '/blog') + }) +}) + describe('Page /blog/article.md', function () { const query = new PagesQuery('./ressources');