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

relLangURL with leading slash repeats baseurl sub-directory #6073

Closed
pacollins opened this issue Jul 6, 2019 · 4 comments
Closed

relLangURL with leading slash repeats baseurl sub-directory #6073

pacollins opened this issue Jul 6, 2019 · 4 comments

Comments

@pacollins
Copy link

pacollins commented Jul 6, 2019

When using relLangURL on a site that has a baseurl with a sub-directory, URLs with leading slash cause the sub-directory to repeat.

baseurl = "domain.com/subdir/"
[[Main.menu.en]]
url = "/page/"
[[Main.menu.fr]]
url = "/page/"

{{ .url | relLangUrl }}
Outcome   ==> /subdir/subdir/page
          ==> /subdir/fr/subdir/page
Expected  ==> /subdir/page
          ==> /subdir/fr/page

This seems like a weird interaction.

Original Issue: pacollins/hugo-future-imperfect-slim#34

@bep
Copy link
Member

bep commented Jul 6, 2019

URLs with a leading slash is considered relative to the server host. You may find it "weird", but it is as designed.

Also note that this has been discussed before.

@pacollins
Copy link
Author

pacollins commented Jul 6, 2019

But what practical application does repeating the subdir give if it is automatically on the url anyway? The subdir from the baseurl can only be subverted by a hard coded link, right? Wouldn't it be more practical to have it go back to the site root and ignore the subdir in the baseurl? Then hugo sites could be functionally nested inside a larger site.

baseurl = domain.com
domain.com/hugo/index.html ==> Hugo site
{{ /otherSite/index.html Site | relLangURL }}  ==> domain.com/hugo/[optLang/]hugo/otherSite/index.html
vs
{{ /otherSite/index.html Site | relLangURL }}  ==> domain.com/[optLang/]otherSite/index.html

And

{{ otherSite/index.html Site | relLangURL }}  ==> domain.com/hugo/[optLang/]otherSite/index.html
vs
{{ otherSite/index.html Site | relLangURL }}  ==> domain.com/hugo/[optLang/]otherSite/index.html

Also the last comment wasn't needed. I spent about an hour or two on here and discourse searching for and issue with relLangURL - maybe my search didn't have the right keywords, but this will provide another for a different search.

@stale
Copy link

stale bot commented Nov 3, 2019

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.

@github-actions
Copy link

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 Feb 11, 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

2 participants