My website is http://www.rootandbeer.com, which when you go there you can see that there is 7 posts made. However when you go to http://rootandbeer.com (no www.) there are only 5 posts. It appears that the first 2 posts i made are no longer present. I for some reason cannot wrap my head around why this is happening. I have switched the theme out for casper to troubleshoot and the problem no longer exists (so it can’t be a caching problem).
Any ideas why this is happening?
That’s interesting. Can yo share more about your setup? Are you self-hosting? If so, how’d you install Ghost? Do you have nginx as a proxy, or something else? I’m guessing that you’ve got /some/ sort of proxy that’s serving a different page for the two domains.
I am self hosting. I set it up as a docker container and I am using cloudflare reverse proxy. That was my first thought when troubleshooting was that it was cloudfare, however when i switched the theme to casper, all of the issues have gone away. Both sites show the correct content when it’s another theme.
Issue is still not resolved.
Checking the console logs (F12, console tab) for your non-www url:
That third one is the problem - your theme uses infinite scroll and is trying to load the second page of posts (where your ‘missing’ two posts should be retrieved from). It can’t, because of a CORS error.
To fix it: Either (1) Set the necessary CORS header on the proxy server or (2) change which URL is used to make the request for page 2 (so that the request matches the domain the browser thinks it’s on), or better yet, avoid this situation and a variety of other issues (cookies, cross-domain requests, etc) by (3) set up one of these domains to REDIRECT to the other, rather than trying to proxy both.
You may not be seeing it with some other themes because they either aren’t using what Ghost is using as the name of the site in the request or aren’t doing a request of this sort. But I wouldn’t bet that this is the only place you’re going to see problems like this. Ghost very much assumes it has one single domain name, and so you may find other problems.
Final thought: Using both domain names (instead of redirecting one to the other) means that the Google bot is going to get really confused. Different subdomains do NOT share page rank, and you’re likely to get dinged for duplicate content. A redirect is the way to go.
I did the redirect and it seems to be working properly now. Thank you!