Created
September 5, 2015 20:05
-
-
Save ianrose/39b1863f474ba2a27694 to your computer and use it in GitHub Desktop.
Harp.js Current Path URI helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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); | |
} %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That was very helpful, Ian, thank you.