.Site.BaseURL is not Updating to config.toml value

I saw you had mentioned on an earlier post from May '17 that this was resolved; however, for me it’s just not working.

The baseURL setting is not updating. This isn’t because I’m running the server on localhost, is it?

config.toml
baseURL = "https://hugo-explore-kalikakay.c9users.io/"

Note: I have tried multiple cases of baseURL, none seem to work. I could still be spelling something wrong.

.Site.BaseURL is called through shortcodes. I have this same problem throughout my site and pages won’t load when I call it.

Who is the “you” there?

Yes. If you run hugo server, the .Site.BaseURL will be "localhost" by default.

Run hugo instead to see your config-set baseURL to be effective.

You might need to do $.Site.BaseURL from within shortcodes.

This is the post I was referring to.

I’m overriding the .BaseURL setting in config.toml. The override isn’t taking affect.

How are you serving out your pages?

Are you running hugo server or npm start from the command line, or do you have a webserver (e.g. apache, IIS, ngnix) which is serving out the html files?

(I’m basically asking the same thing as @kaushalmodi.)

@funkydan2, When I stop and start my development server I write preview -D in the area that’s black and hot pink.
Um… the live server is run by writing hugo, I think. I probably add some other things.
I just know it’s running. I don’t think too hard about how I got it that way.

I’m pretty sure the “hot” server? Production? I mean, it’s not really production it’s more like, that thing I did to get things going. At any rate, I think it might just be a localhost thing that I’m just going to have to deal with.

I mostly just wanted to make sure that no one else was having that problem and that it wasn’t a bug.

shrugs I got the links working, but the behavior is driving me crazy and I saw that post earlier so I thought I’d ask the question.

Yep, I don’t think it’s a bug.

The output of your code (in the image you posted) will give different results depending on how your pages are being served:

  1. If you run hugo server -D then {{ .Site.BaseURL}} will give you http://localhost:8080/
  2. If you run hugo (with some other switches) and then have another webserver serve out the website, then {{ .Site.BaseURL }} will display https://hugo-explore-kalikakay.c9users.io/ (or whatever is set in your config.toml)

The reason for this is hugo server is designed for you to develop and test your site on your computer, and so it ignores the setting in config.toml to make everything work. But when you go live it’ll build the static files with the configured URL.

Well, the good news is, I’ve had the opportunity to update the KISS theme references since I can’t browse http://localhost:8080/.

The .Site.BaseURL setting is pretty much useless for me.

As a matter of fact, I think I might have forgotten to update that tag prior to my gcloud deployment - I got a good kick out of it as I was researching the ref and relref shortcodes.

Thank you so much for your help @funkydan2 and @kaushalmodi

@kaushalmodi and @funkydan2

Whelp, my dev. server shut itself down this morning and for some weird reason, the previous commands listed were all about deployment and before I knew it I was running hugo --help

Low and behold, there’s a baseURL argument! I ran preview --baseURL https://hugo-explore-kalikakay.c9users.io/ and it looks like the baseURL is set now so that I can use it!

There’s no need to override the thing. :smiley:

I feel like such a dunce!

I need to add what it looks like in development vs. production.

Code: TheThing.md

   <p> window.location = "{{< ref "hereis.md" >}}"; </p>
   <p> window.location = "{{< relref "hereis.md" >}}"; </p>
   [The Link]({{< ref "hereis.md" >}})

Where does the link take me?
Development:

Production:

I’d toy around with it more, but it looks like I got the hang of it already.