Check upon index page load whether a fragment package name exists, and redirect to package page if so. Closes #4.
This commit is contained in:
parent
cd06e7fc87
commit
31bb1312e8
|
@ -152,6 +152,7 @@
|
|||
dynamic-static-urlprefix))
|
||||
(bootstrap-dynamic-urlprefix
|
||||
dynamic-urlprefix)
|
||||
(bootstrap-page-scripts (list (static-resource-url "/index.js")))
|
||||
(bootstrap-inline-js
|
||||
(string-append (format "PkgSiteDynamicBaseUrl = '~a';" dynamic-urlprefix)
|
||||
(format "PkgSiteStaticBaseUrl = '~a';" static-urlprefix)
|
||||
|
|
13
static/index.js
Normal file
13
static/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
$(document).ready(function () {
|
||||
// "Cool URLs Don't Break" - catch uses of fragment-based links to
|
||||
// specific packages, and effectively redirect to the new-style
|
||||
// specific package URL.
|
||||
//
|
||||
var oldstyle_link = document.location.hash.match(/#\[(.*)\]$/);
|
||||
if (oldstyle_link) {
|
||||
var linked_package = oldstyle_link[1];
|
||||
document.location = document.location.pathname + 'package/' + linked_package;
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user