masasam/emacs-easy-hugo

Why set `easy-hugo-url` manually?

c-alpha opened this issue · 4 comments

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

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.

[...]
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?

That doesn't work.

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.