Search code examples
wordpressgithubdnsoctopress

Theme is not working in Octopress for a custom domain


I've recently migrated my blog from Wordpress to Octopress.

URL of blog is:

myproject.github.io/octopress

Later I added an A-record to DNS settings of my Wordpress site:

myexample.com   points to 192.30.252.154

Issue: After loading Octopress blog from myexample.com in a browser the standard theme doesn't get loaded, whereas from myproject.github.io it does. Other media like text, pics etc. is loaded in both cases.

Any help appreciated!


Solution

  • This due to the fact that you're serving from two different url schemes : myexample.com and username.github.io/octopress. Here the main difference is the /octopress path.

    This is supposed to be taken into account in _config.yml :

    # If publishing to a subdirectory as in site.com/project set 'root: /project'
    root: /
    

    From the yourdomain.com point of view, it's supposed to be / and from username.github.io/octopress point of view, it's supposed to be /octopress.

    This what break resources loading in one of the cases.

    But the main problem here is the mix between custom domain and github url.

    You'de better put your CNAME file in your username.github.io repository, this will make github redirect all request to username.github.io to yourdomain.com. And all request to username.github.io/repository to yourdomain.com/repository.

    You will have only one url per repository and no more error possible with the octopress config.

    By setting the configuration variable url: http://yoursite.com you will also solve the canonical problem generated by this double url problem. Because of SEO and duplicate content.