From b6d683014d2ddbc01871ef87ff8bc45cd2143242 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Thu, 22 Jan 2015 01:07:48 -0500 Subject: [PATCH] Fixed opening nav items in new tab/window Signed-off-by: Collin J. Doering --- js/default.js | 8 +++++--- src/site.hs | 2 +- templates/partials/nav.html | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/default.js b/js/default.js index 8506716..778f8cc 100644 --- a/js/default.js +++ b/js/default.js @@ -71,7 +71,7 @@ if (page_href === '/') { page_href = '/home.html'; } else if (blog_page_regexp.test(page_href)) { - if (page_href === "/blog.html") { + if (page_href === "/blog.html" || page_href === "/pages/blog.html") { page_href = "/blog1.html"; } @@ -84,8 +84,10 @@ $('a.menuitem[rel="address:' + page_href + '"]').closest('ul').find('li.active').removeClass('active'); $('a.menuitem[rel="address:' + page_href + '"]').closest('li').addClass('active'); - // set page_href of full url for ajax call - page_href = "pages" + page_href; + // set page_href of full url for ajax call when pages/ isn't specified + if (! /\/?pages\/.*/.test(page_href)) { + page_href = "pages" + page_href; + } } // Make the ajax request for the new page-content (whether it be a page or a post) *could change* diff --git a/src/site.hs b/src/site.hs index 728a836..3327ef3 100644 --- a/src/site.hs +++ b/src/site.hs @@ -243,7 +243,7 @@ main = do makeItem "loading" >>= applyAsTemplate indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx - >>= relativizeUrls +-- >>= relativizeUrls --------------------------------------------------------------------------------------------------------- -- NOJS Version ----------------------------------------------------------------------------------------- diff --git a/templates/partials/nav.html b/templates/partials/nav.html index 2af3c3a..43a1211 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -2,7 +2,7 @@