Open andymcfee opened 8 years ago
I solved this with a custom helper.
helpers.js
module.exports.register = function (Handlebars, options) {
'use strict';
Handlebars.registerHelper('relativePretty', function (from, to) {
var url = Handlebars.helpers.relative(from, to);
return url.substring(0, url.indexOf('index.html'));
});
};
nav.hbs:
<a href="{{relativePretty ../../page.dest this.dest}}">
{{title}}
</a>
I will leave this open in case my usecase is actually a bug. But if it is intended to be solved with a custom helper, feel free to close.
I've googled for hours and I can't seem to find any issues, answers, documentation to answer the particular issue I'm having so here it goes... Also, I'm not sure if this belongs here or in another repo's issues, but I'll start here.
My main goal is to generate a set of link for navigation that will use the pretty permalink structure instead of pointing to the
index.html
file of each respective page.Assemble packages:
Relevant assemble config
Handlebars nav partial
Assemble HTML for index.html
Expected HTML
Am I missing something? Is this not possible? If my generated nav is pointing to the
page/index.html
file, this kills the whole point of using pretty URLs, no? Thanks in advance for any assistance. And if I need to open the issue somewhere else or provide additional info, just let me know.