Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jekyll serve creates wrong local post links after base_url change #140

Open
funkenstrahlen opened this Issue Sep 21, 2015 · 8 comments

Comments

Projects
None yet
4 participants
@funkenstrahlen
Copy link

funkenstrahlen commented Sep 21, 2015

Hey,

I just merged the new changes of this project into my fork. This includes the changes made to the base_url handling with the slash.

I have base_url set to '' (empty string) in my config.yml. When I run jekyll serve to test the site locally, I can only access the index site. When I click on a post it links to http://blog/2015/09/21/homebrew-paketliste-sichern/ instead of http://localhost:4000/blog/2015/09/21/homebrew-paketliste-sichern/.

Why does this happen? Should base_url in config.yml be '/' like before? When I do this, this does not fix the problem. I even makes it worse, because CSS does not load any more...

This is the part in index.html which generates the links to the posts:

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

Before merging it was just

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

Maybe this part of config.yml is the problem:

# Permalinks
#
# Use of `relative_permalinks` ensures post links from the index work properly.
# /blog/:year/:month/:day/:title/
permalink:           /blog/:year/:month/:day/:title/
relative_permalinks: true

However changing it to

permalink:           blog/:year/:month/:day/:title/

did not make any difference.

@funkenstrahlen funkenstrahlen changed the title Rake preview can not open posts after base_url change Jekyll serve can not open posts after base_url change Sep 21, 2015

@funkenstrahlen funkenstrahlen changed the title Jekyll serve can not open posts after base_url change Jekyll serve creates wrong local post links after base_url change Sep 21, 2015

@funkenstrahlen

This comment has been minimized.

Copy link
Author

funkenstrahlen commented Sep 21, 2015

It is also broken if I clone exactly this repository and run jekyll serve. Can not click on post links.

@funkenstrahlen

This comment has been minimized.

Copy link
Author

funkenstrahlen commented Sep 21, 2015

Looks like this is similar to #108

@wireddown

This comment has been minimized.

Copy link

wireddown commented Sep 22, 2015

Would you provide some more information?

  1. What version of Jekyll do you use?
  2. Is this a user or project page?
  3. Would you give an example of the HTML for a rendered link?
@funkenstrahlen

This comment has been minimized.

Copy link
Author

funkenstrahlen commented Sep 22, 2015

  1. I use jekyll 2.5.3. Which is the current stable version.
  2. I do not know exactly what you mean with this question. However this bug also happens if I clone https://github.com/poole/lanyon and run jekyll serve. So it is not related to my changes.
  3. Here is the output of the index page: https://gist.github.com/funkenstrahlen/262f2b0798845c2d188e#file-rendered-index-html-L99. I marked the broken link. It is an empty clone of this repository without any changes from my side.
@funkenstrahlen

This comment has been minimized.

Copy link
Author

funkenstrahlen commented Sep 22, 2015

I just figured out what you mean with user or project page. I do not use github as hosting plattform. I host the jekyll generated html files on my own server.

@noxidsoft

This comment has been minimized.

Copy link

noxidsoft commented Oct 4, 2015

This exact same issue is happening to me at http://noxidsoft.clanservers.com/ and I went through the same process as funkenstrahlen before finding this thread. I like this template, but may have to move on as I have no time to fix it myself. Sorry, I'll check back later to see if resolved, moving on.

dhei added a commit to dhei/dhei.github.io that referenced this issue Dec 13, 2015

@asurinsaka

This comment has been minimized.

Copy link

asurinsaka commented Jun 29, 2016

change

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

to

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

@wireddown

This comment has been minimized.

Copy link

wireddown commented Jun 29, 2016

For more details behind the expected usage that @asurinsaka has pointed out, see http://downtothewire.io/2015/08/15/configuring-jekyll-for-user-and-project-github-pages/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.