-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Override section url #3354
Comments
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. |
Just thought I'd chime in and say that this is my single biggest issue using Hugo at the moment, and I think probably the only major roadblock to really powerful multilingual sites. In my case, I have for example a But, in Japanese, I need that section to have the title 意見 (iken), the list page to appear at At the moment, I can get the subpages to have the correct output path ( Languages:
ja:
permalinks:
notes: /iken/:slug in my Even using rewrite rules on Netlify, and throwing some hack-y code into templates and shortlinks using a Param listing these problem sections (ie. It means I can't have a URL that makes sense in the target language, and there's no possible workaround that I can find. On the other hand, if the section's output folder was named after the Then, in ---
title: 意見
slug: iken
--- instead of all those workarounds/.Site.Params/redirect rules. |
I have the same issue now, trying to switch to hugo for an existing site. The concept of _index.[lang].md files for sections is great, and it's one of the biggest issues. |
Hi, I would like to outline the need of this functionality a bit more. Starting with the following three threads in the forum, which are all (more or less) related to this matter. Some of them even explain how to work around this, which, in some case, might actually be applicable.
Multi language support and the need for translating parts of an url is, IMHO, one of the most reasonable use cases for overwriting section names with it's language-specific counterpart. Ideally, the Hopefully, with this I was able to emphasize a bit more on the realness of this feature request. |
The guy is releasing patches twice a week give him a break. I'm just reacting to this last paragraph. Now .34 resolves the section slug issue. You can now add one to your section _index.md. Yet it still doesn't solve your problem ? My posts are stored in content/post and yet, my section slug is /blog thanks to .34 |
Without a doubt, all contributors do an amazing work and I am very thankful for all their effort. I was just citing his own words, which, at least to me, seems to show a bit of an inappropriate attitude in that context. Regarding .34, I couldn't find any hint of this issue being solved in the release. I already installed the latest release and noticed no difference in the behaviour already described. |
Currently, I am also thinking about creating a commercial multi-language website with Hugo and I really like the multi-language support Hugo offers, it makes it really easy and you can see the time and hard work which were invested by contributors, but I have one deal breaker and that is that I didn't find any way to override the section URL. Without the support of overridable sections is the multi-language support good but not usable in anything but private blogs. So I would really appreciate the enhancement else the only other way to create a commercial multi-language website would to create for each language there own Hugo project which makes it viable but that's it.
Can you maybe link or post a example code, would appreciate it. Because it has no effect in my multi-language setup. |
Hi, |
@jonjbar Does the solution @regisphilibert posted here solve your issue? #3354 (comment) |
@budparr I already mentioned above, and happily confirm again that #3354 (comment) does not work for me (v0.36.1). Maybe @regisphilibert has some permalinks applied in the global config file, but again, that approach wont work for nested sections and is merly a workaround. |
@lucendio I understand your problem and yes my comment can help you. I was able to achieve multilingual subsection url overriding using 0.37. If you point me to a repo of some sort I'd try and take a look. Cheers. |
@regisphilibert Interesting. Would you mind posting a simple example or point me to the section in the docs showing how to achieve this? thx, L |
Ok give it a look here: https://github.com/regisphilibert/rp_hugo/tree/greeting-test/ You're not going to be able to fork it as is because the theme is a private submodule but you can still download it and use any theme of your chosing. Then, look at config.toml where permalinks are set. I didn't have time to check templates for it, but if you compile Hugo, you'll see the directory are generated the way you want. |
@regisphilibert Thank you for the sample. Still learning Hugo here but I believe that this is working due to the fact that you have only one section with the following in your config.toml file:
Without that, and if you have multiple sections (e.g. have "blog" section and "products" section...) you can't use the _index.md trick to override the URL of sub-pages. /blog/ -> /blogue Or perhaps I am missing something ? |
Are you saying that (from config.toml)
is not working ? |
@regisphilibert thank you for the example. But sadly this still does not work for sub-sections or scales for multiple sections (as @jonjbar pointed out). The user experience I'd like to see, or I think this thread here is looking for, is described here. In short, it's something around the lines of, the ability to overwrite slug (meaning the part of the url for its specific path level) in its corresponding |
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. |
any news on this? |
This. Feature. Would. Be. Really. Awesome. |
I came up with a solution supporting nested sections assigning custom slugs
Same process for pages. Then each level of the hierarchy will have its corresponding page in Applied this approach in this theme, for example for:
|
It's not been implemented. The PR enables to localize Pages via FrontMatter property 'url'. |
Sad to see this issue is closed, this feature would awesome to have! I hope I haven't missed anything, if I did, please let me know :) |
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. |
Hi all,
I'm building a multilingual site and would like to have 2 different urls for my section list page.
The content is as follows:
Currently, by default, hugo generates /product and /product/product-1 which is expected.
For multilingual purpose, I want to achieve:
English:
French:
I can achieve
/produit/produit-1
by permalinks configuration inconfig.toml
but I don't know how to generate/produit
one which will still use my section template page undertheme/layouts/section/product.html
(same for both language).Any idea would be very appreciated.
Thanks a lot.
P/S: I tried with putting url and slug in
_index.md
and that seems not working although the content of the file is picked up correctly in the template.This is issue is referenced by this discussion.
The text was updated successfully, but these errors were encountered: