I am planning to host assets(css, js, png etc,) on <subdomains>.mydomain.com. I am making these assets using node.js ecosystem. I want to test these files as I edit them in editor along with hugo.
Initially, I put all of subdomain urls to /etc/hosts, But to bind these domains to port 80, I need root access. I am having trouble doing that.
Alternatively, I know that I can use two different config like hugo server -w --config="config-dev.toml" with different assetUrl params. But while updating other params, I will have to update at two places. I really don’t like data redundancy.
Can I swap url like baseUrl param can, to some localhost:port value while running hugo server -w?
I am making this script using nodejs. So, I run this command I get something like
$ gulp watch
serving files from 'assetsBuild/'
serving at http://localhost:3000
Then, I run hugo server -w which is runs on localhost:1313.
I then point my assets.mydomain.com to ip like 127.0.0.11 in /etc/hosts
and tries to bind my nodejs script to port 80.
But, that is failing because of permission issues.
So, It strikes to me, If hugo can somehow replace urls from .Site.Params.assetUrl
to localhost:3000 when running hugo server -w, problem will be solved.
Exactly like baseUrl params gets changed to localhost:1313.
I am not able to find this kind of feature in hugo docs. I am looking for some workarounds.
OK, now I understand … from top of my head I cannot see an obvious workaround. Others may chip in - @spf13 will know. Overriding params from command line would be cool, I guess, but I don’t think that’s possible.
where, keys in [[params.server]] replaces matching keys in [params], while running hugo server command. and in template there is no change needed i.e. {{ .Site.Params.assetUrl }} works as usual.