TryGhost/Source

Pagination doesn't work when Ghost URL is set to a subpath

trostli opened this issue · 1 comments

I have configured my Ghost blog to be hosted on a subpath such as https://example.com/blog/.

However with the Source theme the link to see the next page of posts is linked as https://example.com/page/2

Whereas I believe it should link to as https://example.com/blog/page/2

Looks like the culprit is this line:

<a href="/page/2">See all {{> "icons/arrow"}}</a>

I've solved it for now by using the following Code injection in my admin panel:

<script>
  document.addEventListener('DOMContentLoaded', function () {
      var currentUrl = window.location.href; // Get current URL
      var appendUrl = "page/2"; 
      var newUrl = currentUrl + appendUrl;
      var link = document.querySelector('.gh-more a');
  
      link.href = newUrl; // Set the href attribute
  });
</script>

Hey, thanks for reporting the issue! This is now fixed in d22775c.

While the JS solution you've provided is great, there's a built-in setting {{@site.url}} which suits better in this situation.