masasam / emacs-easy-hugo

Emacs major mode for managing hugo
https://gohugo.io/tools/editors/#emacs
GNU General Public License v3.0
362 stars 26 forks source link

Why set `easy-hugo-url` manually? #66

Closed c-alpha closed 2 years ago

c-alpha commented 2 years ago

Couldn't the value for easy-hugo-url be auto-detected from the baseURL parameter in the config.(toml|yaml|json) file?

masasam commented 2 years ago

If you have two hugos running in one domain, that method will cause problems. For example, in my domain called solist.work, https://solist.work/ is the site managed by the first hugo. https://solist.work/blog/ is the site managed by the second hugo.

The baseurl of https://solist.work/ is as below. baseurl = "https://solist.work/"

The baseurl of https://solist.work/blog/ is as below. baseurl = "/blog/"

In this way, there are examples where baseurl does not become a domain.

c-alpha commented 2 years ago

[...] The baseurl of https://solist.work/blog/ is as below. baseurl = "/blog/" [...]

Ok, that's an example where the value of baseURL in your hugo config is formally not a URL. Somewhat counter-intuitive to me, but seems to work for you.

What if you would set baseURL = "https://solist.work/blog/" in the config of your second hugo site https://solist.work/blog/? Would the generated site still work correctly?

masasam commented 2 years ago

That doesn't work.

c-alpha commented 2 years ago

I see. It's not a show stopper for me, so I think it's probably best to close this issue as "answered".

In case you should still feel like doing something about it, a minimalist compromise could perhaps be to examine the type of the value of easy-hugo-url. If it is a string, that's the URL to use. If it is a function, use the string that the function returns as the URL. Just my two cents anyway.