-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Translated slugs between locales - linked translations via a reference property. Website with localized URL. #137
Comments
Glad to hear that! There are many things to do before general availability, but I love to see people enjoying the product 💯 I’m aware of the i18n issue that corresponds to these Netlify/Decap CMS issues:
Well, first-class i18n support is a selling point of Sveltia CMS. I’ll try to find a solution for this! |
Awesome, wow, thank you for your quick response and your passion work. |
I think the solution is not complicated, actually. In Hugo, it’s possible to link localized files using the I’m going to implement it:
|
that's a clean solution. Looking forward! ;) |
I've encountered an issue with the way filenames are generated from titles, which seems to lack proper sanitization for URL use. For instance, the title "La Cédille En Français" results in the filename la-cédille-en-français.yaml. This filename includes special characters that are undesirable in URLs. config.yaml
Feature Request: config.yaml This would allow the key value to be generated as a slugified and sanitized URL segment. Going further: javascript
This function could be utilized in the configuration like this: config.yaml
As I understand implementing such a feature would enhance flexibility without posing a security risk, the script execution would be confined to authenticated user contexts. If I'm wrong, please excuse me. |
You can use the slug type option 🙂 Add this to your slug:
encoding: ascii
clean_accents: true |
Yes! it works and filenames are sanitized now. Somehow it slipped through my eyes :)
I get this: but for my i18n setup I need to get this: Is there some option to pass the sterilized slug to the field property? |
I think my |
When you customize the slug like this: slug: '{{title | localize}}' Then file names will be localized, and
|
omg! Thank you very much! |
Just shipped v0.25.0 with the localized slug support 🎉 |
super cool! thank you, kyoshino! |
I tried and it is awesome! is there some way to add to my custom key the translationKey with custom string?
the idea is to pass translationKey to any field via compute. That way anyone would be able to work with custom file based routing workflows. |
I’m playing with your demo project. I think i18n:
structure: multiple_folders
locales: [en, fr]
canonical_slug:
key: defaultLocaleVersion
value: 'en/{{slug}}' |
astrolicious i18n plugin behind the scenes changes the schema at the dev run and the frontmatter expects locale/slug, so it's not possible without forking and modifying repo. but either way it works perfectly:
I understand that is quite a niche issue. :/ |
No worries! |
That is very nice of you. I will be able to add sveltia cms to my i18n blog template. |
That's super awesome! Can't believe that you just solved my biggest issue and now astro full localization works with sveltia cms out of the box! I'm going to check if it's working fine with astrolicious i18n. |
Thanks for finding bugs! Will fix them shortly. There is supposed to be a toast notification after duplicating an entry. Not sure why it’s gone 😅 |
Just shipped v0.26.3 to solve the issues! |
now canonical_slug is working at duplication. thank you! |
Hello, I like sveltia cms a lot, in my opinion, sveltia cms is currently the best open source cms in the market.
I'm trying to find a solution for how to make localized markdown filenames work in sveltia cms. The post becomes quite long so I will structure it as readable as possible.
Description
I am currently working on localizing a website, I have done localization with the Astrolicious i18n tool, now I'm trying to work with Sveltia/Decap CMS. Despite extensive searches, I have not found a way to utilize translated filenames for the CMS content. I'm hoping to determine if it's feasible to make it work, I'm looking for any hacky solution as injecting a custom JavaScript into the CMS widget that allows searching for localized posts using translated filenames.
Current Implementation
For testing, I utilized the demo repository from the Astrolicious i18n tool and adapted it to my needs. Here are the relevant links:
GitHub Repository: astrolicious-i18n-demo
Live Demo: astrolicious-18n-demo.netlify.app
Currently, the testing CMS setup is as follows:
Objective
My final goal is to create localized URLs based on slugs taken from Markdown filenames. For instance:
English URL: website/blog/english-post/
French URL: website/fr/le-blog/poste-francaise/
The i18n tool locates the localized YAML file by reading the defaultLocaleVersion, which points to the corresponding default locale file (en/english-post). That way i18n is able to generate localized routes.
Question
Is it possible to use some custom widget to enable sveltia cms locating for posts with localized filenames based on this reference?
I've managed to create a post with a default locale reference, but I'm still unable to create localized filenames directly in the CMS and "match" localized posts
Any insights or suggestions on how to implement this feature, or just tell that localized filenames are not possible, would be greatly appreciated.
The text was updated successfully, but these errors were encountered: