Style.css in multilingual mode

How to properly link stylesheet in head using multilingual setup.

I’m using this code:
{{ $style := resources.Get “style.css” | resources.Minify | resources.Fingerprint “sha512” -}}

But it’s pointing from DomainB to DomainA/style.min… this way it’s broken.
Same code works ok, when using only one domain and languageB is in subfolder.

If i switch from .Permalink to .relURL it’s working in multiple domains but not subfolder setup.

It does not seem to work in the asset pipes. This is not the first time I read here about issues with multi-language sites and stylesheets/javascripts. It seems there is no multi-language support in the asset pipe available.

Which means let’s light up the bat sign: @bep :wink:

Another post here about the same kind of issues, this time javascript: Is it possible to use translations in assets?

It would be nice if asset-templates would be able to use i18n-features.

Just a friendly reminder that I never reply to posts that mention my name for no good reason. Note that I read most threads in here anyway, and not mentioning my nick would then be 100% more effective :slight_smile:

1 Like

@zabatonni have a look at this solution in the post I linked: Is it possible to use translations in assets?

It looks like you should use a language path instead of just referencing style.css.

 | resources.ExecuteAsTemplate  (printf "%s/js/script.js" $.Site.Lang ) . | 

I personally am not using Hugo for multilingual pages so you won’t get any helpful advise from me :wink:

.RelPermalink is working even if baseurl is set to subfolder. But its strange to use relative links for css and js and abs urls for the rest of website.

Well the way you link them is relative. It could be whatever/path/you/wish. It’s not inside your content directory, hehe. But by using a path containing the language code you make it individual instead of Hugo trying to save time by using assets only once per run instead of once per path.

could you please explain that last sentence. I think i dont get it.