Open cmawhorter opened 8 years ago
This is a little weirder than I thought and the workaround should be in the theme helper as such:
var theme = {
url: function(page) {
if (page.urlTemplate || page.routes <= 1) {
return page.url();
}
else {
return page.route[0];
}
}
};
That should work for most scenarios and allow for:
ejs
<link rel="canonical" href="<%= theme.url(page) %>"> //
<link rel="canonical" href="/one"> //
template
Workaround is to specify a
urlTemplate
which overrides route<meta key="urlTemplate" value="/one">
Or to use an array index
page.url()[0]
Or to use a theme helper
theme.url(page)
->url(page) => { return page.url()[0]; }