grunt-assemble-permalinks
grunt-assemble-permalinks copied to clipboard
Dynamically build slugs dosen't work
My Scripts version: grunt-assemble: 0.4.0 grunt-assemble-permalinks: 0.1.0
The documentation describes how to dynamically build slugs: https://github.com/assemble/grunt-assemble-permalinks#dynamically-build-slugs
When I'm trying to render my HTML pages, the variables (<%= area %> & <%= section %>) are not resolved.
I get the following render:
blog/2014/01/01/<%= area %>-<%= section %>/index.html
Instead of:
blog/2014/01/01/business-finance/index.html
I also download the clear grunt-assemble-permalinks-master from Github.
Then I added the variables to the file /test/fixtures/pages/articles/bar.hbs
:
---
title: Bar
author: Jon Schlinkert
area: business
section: finance
slug: <%= area %>-<%= section %>
date: 2013-10-03
section: blog
tags:
- bbb
---
After that I executed grunt default
. Same behavior.
Now I got the folowing render:
test/actual/yfm_custom_property/articles/<%= area %>-<%= section %>/index.html
Instead of:
test/actual/yfm_custom_property/articles/business-finance/index.html
Any idea how to fix the issue?
@meglinmedia Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
As a test, try adding the following object to the assemble options in your Gruntfile.js:
{
data: {
area: 'one',
section: 'two'
}
}
Then run it and see if that data is used in the permalinks. I want to narrow down where the issue is
I'm unsure if I have understood correctly...
Like that?
assemble: {
options: {
plugins: ['index.js'],
helpers: [
'handlebars-helper-eachItems',
'handlebars-helper-paginate',
'test/fixtures/helpers/*.js'
],
layout: 'test/fixtures/default.hbs',
assets: 'test/assets',
data: {
area: 'one',
section: 'two'
}
},
// Should modify dest path using a custom property from YAML front matter
yfm_custom_property: {
options: {
permalinks: {
// 'slug' is a custom property in YAML front matter
structure: ':slug/index:ext'
}
},
files: [
{expand: true, cwd: 'test/fixtures/pages', src: ['**/*.hbs'], dest: 'test/actual/yfm_custom_property/', ext: '.html'}
]
},
},