URLs and relative paths

Hi guys,
I have a terrible issue that probably some expert here just laughs about:

I want have built this website with the Hugo academic template (almost in standard configuration): www.fabianfalck.com

If you click on the “website” icon under “accepted papers”, I get redirected to “http://fabianfalck.com/http:/www.politicalcompass.de”. This path should obviously be without the prefix of my website (since it points to another website). However, this does not happen e.g. for the soundcloud link icon in the top left of the page.

I think this problem is related to the relativeURLs parameter in the config.toml file which I set to true. If I don’t do that, the documents in the /static/ folder would not work. The weird thing is everything works properly in both cases when I use “hugo server”, but not when I put it on my website.

Can someone tell me how to properly configure this?

In config.toml, what is your baseURL set to?

It is set to a couple of combinations: "http://fabianfalck.com/", "./" and various other suspects. The problem is I think related to that, but it wasn’t the obvious suspects.

Try setting it to only one value, i.e. http://fabianfalck.com/

When I do this, the site gets weirdly displayed like on the image attached. I assume it cannot find the right path then.

UPDATE: It magically works exactly as you said. I promise I tried this 100 times… Thanks a lot!

ok. I now have baseurl set as you said and relativeURLs=true .

Everything works except that the links to external sites are still incorrect having the prefix of my website that they should not have. Anyone knowing what to do?

It’s difficult to troubleshoot further without seeing your code. Is your site in a git repo? If so, post a link to it here. If you can’t do that for some reason, at least show us your full config.toml file.

I really appreciate your help!

I uploaded the full config.toml file here: https://github.com/FabianFalck/upload/blob/master/config.toml

Your baseURL is currently set to /. It needs to be the URL of your site as I mentioned above.

Which external links in particular are you seeing the issue? Your entries for [[params.social]] look fine.

I tried this. It doesn’t work. I’ll set it to the website title exactly as you mentioned above, just so that you can see the behavior on the site.

The issue appears when you click on “Website” under " Accepted Papers" -> the second entry.

There, not the correct internet (web) link, but the one with a prefix of my website appears.

Show the code where you are setting the URL value(s) for that

I uploaded it here: https://github.com/FabianFalck/upload/blob/master/ipp2018.md (just display it in raw format)

-> the broken ones are e.g. url_custom and url_dataset.

Thank you very much for your help!

url_custom and url_dataset look fine.
What happens if you set relativeURLs = false ?

Then, the page gets displayed completely weirdly as shown on the image above.

I assume that the .css file cannot be found in this case. However, then all links work.

Note: The relativeURLs thing I inserted manually (was not in the basic configuration contained) so that at least the page looks nice.

Hmm. You mentioned the site looks fine when running hugo server. So how are you deploying the site?

That’s correct. Basically I push the website via FTP to my website. I don’t use gitlab.io or anything similar.

That’s the weird thing that it works with hugo server, but I think people reported that before and had similar issues, but the google hits did not solve my problem (I searched quite extensively)…

Since it works locally, my guess is the issue is with your web host. Especially since baseURL is behaving like it is.

@fabianfalck have a look at the HTML that hugo is outputting. I went to your site, and noticed that there’s some strange links being built like this:

<a class="btn btn-outline-primary my-1 mr-1 btn-sm" href="./http:/www.politicalcompass.de" target="_blank" rel="noopener">

It’d be worth checking that the HTML created by Hugo is the same as what is being served out onto the web.

My guess is that since you’re not using a subdirectory for your site, you shouldn’t need to have relativeURLs set true, and then you’ve got to work out why images/css isn’t being loaded correctly. It could be to do with making sure you start references to files (css/images) with / in the appropriate places (and not, when you shouldn’t!).

If you were able to put your whole site on github it would be a big help as we could clone your site and have a full look.