mtmeyer
mtmeyer

Reputation: 282

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?

Upvotes: 3

Views: 893

Answers (2)

Strahinja Kustudic
Strahinja Kustudic

Reputation: 4472

The easiest way to serve static files on GitHub Pages without Jekyll is to create a file .nojekyll in the root of the repository. That will tell GitHub not to parse files as Jekyll.

Upvotes: 1

David Jacquel
David Jacquel

Reputation: 52799

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

Upvotes: 2

Related Questions