Skip to content

Commit

Permalink
Meta: make link-fixup.js only look at the path for 404s
Browse files Browse the repository at this point in the history
The Table of Contents link to index.html was redirected to
indices.html#index, and similarly all multipage pages without a
hash was being redirected (sometimes correctly, sometimes not).x
  • Loading branch information
zcorpan committed Aug 31, 2017
1 parent d033b46 commit 0865c4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions link-fixup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
xhr.onload = function() {
var fragmentLinks = xhr.response;

// handle section-foo.html links from the old old multipage version,
// and broken foo.html from the new version
if (!fragid || !(fragid in fragmentLinks)) {
// Handle section-foo.html links from the old old multipage version,
// and broken foo.html from the new version. Only run this for 404s.
if ((!fragid || !(fragid in fragmentLinks)) && document.title === '404 Not Found') {
var m = window.location.pathname.match(/\/(?:section-)?([\w\-]+)\.html/);
if (m) {
fragid = m[1];
Expand Down

0 comments on commit 0865c4d

Please sign in to comment.