Search code examples
htmlcssjekyllgithub-pages

Relative links in Github Pages without Jekyll


I created a single-page static website which has been uploaded to GitHub Pages. I have come across the common problem related to GitHub Pages and relative links.

i.e. "assets/img/img.png" becomes "assets/css/assets/img/img.png"

I found some solutions which involved Jekyll and creating a base url in the _config.yml file.

Is there another solution which does not involve Jekyll?


Solution

  • Use urls relative to root : /repoName/assets/img/img.png.