Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect permalink URL for stylesheet and JS on multihost (multilingual) with Asset bundling #8109

Closed
adityatelange opened this issue Jan 1, 2021 · 10 comments

Comments

@adityatelange
Copy link

adityatelange commented Jan 1, 2021

What version of Hugo are you using (hugo version)?

v0.80.0

Does this issue reproduce with the latest release?

Yes


Reading https://gohugo.io/content-management/multilingual/
and setting up config like mentioned here

image

image

config.yml:

DefaultContentLanguage: "en"
title: "PaperMod"
theme: hugo-PaperMod
paginate: 5
languages:
    en:
        baseURL: https://example.com
        languageName: "English"
        weight: 1

    hi:
        baseURL: https://example.hi
        languageName: HINDI
    ar:
        baseURL: https://example.ar
        languagedirection: rtl

Code snippet used by Papermod to generate links:
https://github.com/adityatelange/hugo-PaperMod/blob/5d6de5ecb1febac645b56cca7596ad0ce2ab9054/layouts/partials/head.html#L24-L36

Output

I can observe that urls aren't generated the way they should be a/c to docs

image

image

image

This Issue was from adityatelange/hugo-PaperMod#126

Am I missing something ? Please let me know if anything is wrong on my end :)

@adityatelange
Copy link
Author

cc: @moorereason
Sorry for tagging, can you please take a look ?

@davidsneighbour
Copy link
Contributor

What happens if you use absLangURL on the stylesheet URL?

{{ $stylesheet.Permalink | absLangURL }}

@adityatelange
Copy link
Author

adityatelange commented Jan 10, 2021

What happens if you use absLangURL on the stylesheet URL?

{{ $stylesheet.Permalink | absLangURL }}

image

@davidsneighbour same results

image

image

image

@davidsneighbour
Copy link
Contributor

So we keep tagging @moorereason ;)

@moorereason
Copy link
Contributor

This is a question for @bep. Like 90% of everything in Hugo, he wrote all of the multilingual and resources code.

A work-around would be to pass a relative link to absLangURL. If absLangURL is passed an absolute link (with a https:// prefix), it simply returns the input (we should be mentioned in the docs). Try this:

{{ $stylesheet.RelPermalink | absLangURL }}

@adityatelange
Copy link
Author

This is a question for @bep. Like 90% of everything in Hugo, he wrote all of the multilingual and resources code.

A work-around would be to pass a relative link to absLangURL. If absLangURL is passed an absolute link (with a https:// prefix), it simply returns the input (we should be mentioned in the docs). Try this:

{{ $stylesheet.RelPermalink | absLangURL }}

Thank you ! That works :)

But shouldn't it be generating it with .Permalink way ? as all other media like images in page bundles, links, pagination works perfectly fine with only .Permalink.

@adityatelange
Copy link
Author

adityatelange commented Jan 17, 2021

But shouldn't it be generating it with .Permalink way ? as all other media like images in page bundles, links, pagination works perfectly fine with only .Permalink.

@moorereason @davidsneighbour Any updates on this ? Is it a bug or it is working as intended ? 🤔

This is a question for @bep. Like 90% of everything in Hugo, he wrote all of the multilingual and resources code.

A work-around would be to pass a relative link to absLangURL. If absLangURL is passed an absolute link (with a https:// prefix), it simply returns the input (we should be mentioned in the docs). Try this:

{{ $stylesheet.RelPermalink | absLangURL }}

Update: This does not work when there is only one baseURL in multilingual site, but works on configs with specific baseURL defined for each language.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@adityatelange
Copy link
Author

Hi @bep

This issue is still reproducible. Requesting you to please look into this.

image

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants