Search code examples
jekyllgithub-pagespermalinks

Github Pages and Jekyll permalinks going to different paths


I have a site running locally with Jekyll and deployed to GitHub Pages without any issues.

The issue I have is with GitHub pages and local permalinks.

https://username.github.io/my-repositary

and localhost is going to the root

http://localhost:4000/

So adding a page About in the root and linking to ends up looking like this

https://username.github.io/about
http://localhost:4000/about

Rather than the desired outcome

https://username.github.io/my-repositary/about
http://localhost:4000/about

Solution

  • Jekyll allows you to specify a subpath for the page you are generating via the baseurl option in the _config.yml file. In this case, yours should add this line to it:

    baseurl: /my-repositary