Closed zeakey closed 1 year ago
I just setup a jekyll website with Jekyll and everything works well locally.
When deploying this site to github pages, I found that the baseurl variable was not properly rendered. What I have in my _config.yaml is: https://github.com/batchfy/batchfy.github.io/blob/ab6dddf4ddf6241a520027c9b9883842648b079d/docs/_config.yml#L1-L2
baseurl
_config.yaml
baseurl: '/'
However, it was rendered as an empty string (""), which broke many url links in my website.
For example, line57 of <batchfy.github.io/team/index.html>:
<a href=""><img width="120px" height="32px" alt="Batchfy" src="[/images/logo/logo.svg](view-source:https://batchfy.github.io/images/logo/logo.svg)" /></a>
The href to the logo should be /, but is actually an empty string.
/
This href is set to baseurl in the theme: https://github.com/batchfy/batchfy.github.io/blob/ab6dddf4ddf6241a520027c9b9883842648b079d/docs/_includes/header.html#L4
<a href="{{ site.baseurl }}"><img width="{{ site.logo.desktop_width }}" height="{{ site.logo.desktop_height }}" alt="{{ site.title }}" src="{{ site.logo.desktop | relative_url }}" /></a>
baseurl should be rendered to /, rather than an empty string.
baseurl was renderred as an empty string.
I have manually checked the generated html codes and found that the remotely and locally generated are different. Local codes are correct while github page generated html codes are incorrect.
Definitely recommend using relative_url or absolute_url filters (either with or without a piped-in argument):
relative_url
absolute_url
{{ "my_url" | relative_url }} {{ relative_url }} {{ "my_url" | absolute_url }} {{ absolute_url }}
This issue affects
What did you do (e.g., steps to reproduce)
I just setup a jekyll website with Jekyll and everything works well locally.
When deploying this site to github pages, I found that the
baseurl
variable was not properly rendered. What I have in my_config.yaml
is: https://github.com/batchfy/batchfy.github.io/blob/ab6dddf4ddf6241a520027c9b9883842648b079d/docs/_config.yml#L1-L2However, it was rendered as an empty string (""), which broke many url links in my website.
For example, line57 of <batchfy.github.io/team/index.html>:
The href to the logo should be
/
, but is actually an empty string.This href is set to
baseurl
in the theme: https://github.com/batchfy/batchfy.github.io/blob/ab6dddf4ddf6241a520027c9b9883842648b079d/docs/_includes/header.html#L4What did you expect to happen?
baseurl
should be rendered to/
, rather than an empty string.What happened instead?
baseurl
was renderred as an empty string.Additional information
I have manually checked the generated html codes and found that the remotely and locally generated are different. Local codes are correct while github page generated html codes are incorrect.