Hi! First of all, thank you so much for making Ghost the great platform that it is.
I’m in the process of setting up a new blog, and I’m trying to make all posts appear under the “/post/” subdirectory. I also want to keep all my pages on the main “/” directory, however. What I came up so far by editing the routes.yml
file is this:
routes:
/:
controller: channel
template: index
collections:
/post/:
permalink: /post/{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
And it works pretty fine. All posts show under their respective slug: https://example.org/post/post-1
, etc.
There is one issue, however. If I go to https://example.org/post/
, without specifying the post, I see my homepage. All the other pages are under the main directory (eg https://example.org/about/
), however, the homepage shows in both places: https://example.org/
and https://example.org/post/
. This is also shown by the fact that the sitemap.xml
shows it as a separate page, indeed:
URL (6 total) Images Last Modified
https://example.org/post/ 0 2020-11-09 10:46
https://example.org/ 0 2020-11-09 10:46
https://example.org/contact/ 0 2020-11-09 09:13
https://example.org/about/ 1 2020-11-06 13:22
As if I manually created a “post” page from the Ghost admin interface. If I restore the default routes.yml, the page obviously disappears.
The only way I thought this could be avoided is by using the redirects.json
file. However, If I add a redirect that points “/post/” to “/”, it correctly redirects me there, but the sitemap.xml now has an even bigger issue: the /post/ page is listed twice:
URL (6 total) Images Last Modified
https://example.org/post/ 0 2020-11-09 10:46
https://example.org/post/ 0 2020-11-09 10:46
https://example.org/ 0 2020-11-09 10:46
https://example.org/contact/ 0 2020-11-09 09:13
https://example.org/about/ 1 2020-11-06 13:22
This makes the /post/ page appear higher in search results, and sometimes gets mistakenly confused as the true homepage. Does anyone have any idea on how to fix this? Thanks!