Sethe23
Sethe23

Reputation: 2682

Jekyll post links not including base url

I've added my baseurl to the config for Jekyll, but every permalink is not appending it. I'm using Jekyll version 2.5.3 and Apache.

This is what the config looks like for all relevant content:

baseurl: /blog 
host: 0.0.0.0
permalink: /:year/:month/:day/:title
destination: /var/www/html/blog/_site/

The directory structure is the way it should, but the link request all show localhost/2015/06...

Does the routing need to be adjusted by Jekyll or Apache?

Upvotes: 1

Views: 487

Answers (2)

Bart Ramaekers
Bart Ramaekers

Reputation: 23

I understand this question might be outdated, but I also ran into this issue while hosting a Jekyll blog on GitHub pages.

You can use the relative_url Liquid Filter provided by Jekyll to automatically prepend any url with the baseurl configured in _config.yml.

Example:

<a href="{{ post.url | relative_url }}">{{ post.title }}</a>

Relative URL
Prepend baseurl config value to the input to convert a URL path into a relative URL. This is recommended for a site that is hosted on a subpath of a domain.

Upvotes: 2

David Jacquel
David Jacquel

Reputation: 52829

You have to explicitly use site.baseurl. Jekyll doesn't automatically prepend it to urls.

<a href="{{site.baseurl}}{{post.url}">

Upvotes: 1

Related Questions