Skip to content

Instantly share code, notes, and snippets.

@ianrose
Created September 5, 2015 20:05
Show Gist options
  • Save ianrose/39b1863f474ba2a27694 to your computer and use it in GitHub Desktop.
Save ianrose/39b1863f474ba2a27694 to your computer and use it in GitHub Desktop.
Harp.js Current Path URI helper
<% var last = current.path[current.path.length -1] %>
<% function pathURI(currentPath) {
var pagePath;
for(var i=0; i< currentPath.length; i++) {
if(currentPath == 'index'){
pagePath = url+'/';
} else {
pagePath = url+'/'+currentPath[i];
if(currentPath[i] !== last){
'/'
}
}
}
return encodeURIComponent(pagePath);
} %>
@allergeek
Copy link

That was very helpful, Ian, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment