Subdomain on GitHub Pages Creating Strange Links

I have a blog up on Github Pages sourced from the docs folder on the master branch. It is on the subdomain blog.keishasperkins.com. It’s giving me an issue with all of the links pointing to the BaseURL twice. For example:

href="{{ .Site.BaseURL}}/css/custom.css" is linking to a stylesheet at blog.keishasperkins.com/blog.keishasperkins.com/css/custom.css which doesn’t exist. All of the links are doing this.

I have…

  • Checked to be sure that baseURL = "blog.keishasperkins.com"
  • Removed {{ .Site.BaseURL }} from links in the <head>, having them link relatively
  • Clicked links to the stylesheets and js from “view source” and got the same double URL
  • Opened my hugo-generated index.html locally with no issue

Even if I try to type blog.keishasperkins.com/css/custom.css I get a 404 from GitHub Pages. Something must be happening with the way GitHub Pages is handling the links…or at least I think it must. I’m stumped.

If it helps, the repo can be found at GitHub - KeishaSPerkins/ksp_blog: A simple blog

I have never seen base URLs without protocols. Do you want to try adding an https:// or http:// prefix to it?

Also I see that you have hard coded the baseURL in all custom.css hrefs. I would instead do: {{ "/css/custom.css" | absURL }}.

2 Likes

Thanks. That solved it @kaushalmodi.

1 Like