Relative URLs in Jekyll

Found this great resource that explains how to create dynamic paths when linking your images in your layouts:

The layouts were in _layout directory but the images are in images directory. Since the pages using the layout are also organized in different directories, the   path would change based on where the .html was located. Because of this, the images were breaking because the path to the file kept changing depending on where in our project directory the .html existed.

To prevent this issue, using {{site.github.url}} loads the images correctly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s