Skip to content

Commit

Permalink
Append index.md if we hash points to a folder
Browse files Browse the repository at this point in the history
 * It is considered to be folder if the url hash ends with a /
  • Loading branch information
Dynalon committed Nov 29, 2013
1 parent 37ae63d commit bbaa7af
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,32 @@
}
}

function appendDefaultFilenameToHash () {
var newHashString = '';
var currentHashString = window.location.hash || '';
if (currentHashString === '' ||
currentHashString === '#'||
currentHashString === '#!')
{
newHashString = '#!index.md';
}
else if (currentHashString.startsWith ('#!') &&
currentHashString.endsWith('/')
) {
newHashString = currentHashString + 'index.md';
}
if (newHashString)
window.location.hash = newHashString;
}

$(document).ready(function () {

// stage init stuff
registerFetchConfig();
registerBuildNavigation();
extractHashData();

if (window.location.hash === '' ||
window.location.hash === '#'||
window.location.hash === '#!')
{
window.location.hash = '#!index.md';
}
appendDefaultFilenameToHash();

$(window).bind('hashchange', function () {
window.location.reload(false);
Expand Down

0 comments on commit bbaa7af

Please sign in to comment.