Pagination doesn't work when Ghost URL is set to a subpath
trostli opened this issue · 1 comments
trostli commented
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:
Source/partials/components/post-list.hbs
Line 118 in 0798ee6
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>
minimaluminium commented
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.