Baseurl set up

Hi guys, i dont understand what i should set for baseurl.
This is my original block done with jekyll: https://jubalh.github.io/blog/
This is my new one with hugo: https://jubalh.github.io/blog1/
for some reasons links dont work…

i only added the public hugo folder to the gh-pages branch because i couldnt get it to work with this guide “github-pages” tutorial from the hugo site (can only post two links thats why i dont linke to it here)

Hope somebody can help.

And here is the hugo based “code” of my blog: https://github.com/jubalh/testr

I am looking for the mistake since 4 hours. Hope somebody in here can help :slight_smile:

Hi @Michael_Vetter,

You are using Hugo v0.12, right? If so, please add a trailing slash to your baseurl, i.e., changing:

baseurl = "http://jubalh.github.io/blog1"

to

baseurl = "http://jubalh.github.io/blog1/"

should get it to work for you.

Hugo v0.13-DEV has added a patch so that a baseurl with subdirectory would work with or without a trailing slash. For all the gory details, please read https://github.com/spf13/hugo/issues/793 and https://github.com/spf13/hugo/issues/799.

Hmm… strange… I couldn’t reproduce your error with Hugo v0.12 even without the trailing slash. Oh, wait, #793 and #799 I referred to in my previous message only applies when running hugo server, which obviously isn’t what you are doing here. My apologies.

Have you already fixed your problem? On your website, e.g. the source HTML of https://jubalh.github.io/blog1/post/2014-12-13-devlxqttoo/, I see:

<link rel="stylesheet" href="./css/syntax.css">		
<link rel="stylesheet" href="./css/main.css">
<link rel="stylesheet" href="./css/responsive.css">

but in your layouts/partials/head.html, you have

<link rel="stylesheet" href="{{ .Site.BaseUrl }}/css/syntax.css">
<link rel="stylesheet" href="{{ .Site.BaseUrl }}/css/main.css">
<link rel="stylesheet" href="{{ .Site.BaseUrl }}/css/responsive.css">

And you have canonifyurls = true defined in config.toml too. Either canonifyurls = true or {{ .Site.BaseUrl }} (or both) would result in full URLs that I see generated when I tested your code, e.g. in public/post/2014-12-13-devlxqttoo/index.html:

<link rel="stylesheet" href="http://jubalh.github.io/blog1/css/syntax.css">
<link rel="stylesheet" href="http://jubalh.github.io/blog1/css/main.css">
<link rel="stylesheet" href="http://jubalh.github.io/blog1/css/responsive.css">

So I guess you may have already fixed your problem?

Hello @anthonyfok !Thanks for your reply! :slight_smile:
Yes, that’s exactly what’s confusing me too. I use .Site.BaseUrl but see ./css/syntax.css.
I have no idea how this happens. It’s my first time with hugo, so I figured it’s a mistake on my end, but I just can’t find it :-/

Going to add the trailing slash and see if it changes anything anyways. Would be glad to hear other ideas if it doesn’t.

regards,
Michael

Hi @Michael_Vetter,

Which version and which OS are you using? If Hugo v0.12, I highly recommend that you try to compile the latest Hugo v0.13-DEV from source, especially if you are running Windows.

@anthonyfok actually I am using v0.13-DEV BuildDate: 2015-02-03T21:18:03+01:00 on OSX. Gonna try on Linux later, so far no luck sigh I hope I can find a solution to be done with the basics of the blog and start actually writing articles :slight_smile:

Let me know if you have any other idea.

@anthonyfok

I still couldnt solve this :frowning: Tried it on Linux too, same thing.
Well. Actually CSS/JS works now, no reason why, didnt change anything, pictures work too, but when i try to use pictures in the posts like this:

 <a href="{{ .Site.BaseUrl }}/images/lxqt_screenshot_1920x1080.png">

Then it gets translated to:

http://localhost:1313/blog1/post/2014-12-13-devlxqttoo/%7B%7B%20.Site.BaseUrl%20%7D%7D/images/lxqt_screenshot_1920x1080.png

And thus does not work, I dont see why.

My source is here

@Michael_Vetter Are you including these in the markdown files?

Markdown files aren’t processed for variables, only templates are.

<a href="/images/lxqt_screenshot_1920x1080.png">

should work for you.