From baf4d824d9a89d3a8f9bb761ff5c0a1ae8ec57f8 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Thu, 4 Aug 2022 21:33:02 -0700 Subject: [PATCH] Move feed redirect to route() Otherwise back button will not work as expected --- script.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index 85b95b0..4fdcee0 100644 --- a/script.js +++ b/script.js @@ -163,9 +163,6 @@ async function showPage(path) { document.querySelector('main').replaceWith(postMain); hljs.highlightAll(); } - else if (path === '/atom.xml') { - location.href = `${location.origin}${path}`; - } else { // MUST redirect to a page where the web server serves an actual 404 error (i.e. not just // index.html again) otherwise this triggers an infinite loop @@ -181,8 +178,8 @@ function route(href) { if (location.href === url.href) { return; } - // If the new page is on a different host, redirect as expected - if (location.host !== url.host) { + // Redirect as expected for outside hosts or Atom feed + else if (location.host !== url.host || href === 'https://ardislu.dev/atom.xml') { location.href = href; return; } -- 2.47.3