-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adjusting URL and Display Settings for Chinese Categories and Tags in Astrowind Theme #397
Comments
Hello, I'm currently utilizing the Astrowind theme for a project involving Chinese language content, and I've encountered some issues with how URLs are generated for categories and tags, as well as the display of categories and tags in Chinese. My understanding of code is quite limited, but I was advised that these issues might be related to how strings are processed and converted into slugs, particularly with regard to the inclusion of tone marks in pinyin. Issues Identified:
Possible Clues for Modification:
Since I'm not proficient in coding, I'm unable to make these modifications myself. Thus, I'm reaching out to see if you could kindly consider making these adjustments to the theme's source code. Such changes would greatly enhance the usability of the Astrowind theme for projects involving Chinese content. Thank you very much for your time and consideration. Your effort and contribution to the open-source community are deeply appreciated. |
Hi @zipziz Thank you very much for bringing this to the table. There are aspects about the Chinese language that we do not know in depth and we ended up using limax due to a recommendation from a long time ago. Your idea of having a configuration to decide different characteristics of slug generation seems very good to us. There may even be a setting to disable this conversion completely. We will be working on it. If you have any more suggestions related to how to deal with Chinese language slugs please let us know. |
Hi again @zipziz We were reviewing the idea of adding settings for limax in the Better we are going to give you the solution here of what you need for not use tone in slugs. Go to this file on the marked line: https://github.com/onwidget/astrowind/blob/main/src/utils/permalinks.ts#L21 export const cleanSlug = (text = '') =>
trimSlash(text)
.split('/')
.map((slug) => slugify(slug))
.join('/'); And replace it with this code: export const cleanSlug = (text = '') =>
trimSlash(text)
.split('/')
.map((slug) => slugify(slug, { tone: false }))
.join('/'); In that case all slug conversions will stop using the tone Please let us know if this solution works for you and if everything works ok for you. Thank you |
Thank you for the work on this project. I've encountered an issue regarding the Steps to Reproduce:
Expected Result: The category title on the page should display the original Chinese characters, i.e., "数字技术". Actual Result: The category title is displayed in pinyin as "Shu Zi Ji Shu", not in the original Chinese characters "数字技术". Suggested Fix: It would be greatly appreciated if there's a way to display the original Chinese characters for categories and tags on the category pages and blog detail pages, alongside handling the URL conversion without tones. Thank you for considering this issue. I look forward to any suggestions or updates on this matter. |
Hi @zipziz We have noticed the problem. Usually it does not feel strange in the English language or others that do not have conversion with We were reviewing in depth and the only idea we can think of is that for cases like these, the template will have to define Contents Collections for Categories and Tags. We think it should be optional in case you need the title to be displayed correctly. Most users probably don't want to put in the effort of creating a new Category in their Content collection every time they add a Category to a Post. We will be working on it and we will let you know very soon. |
Hi @prototypa I've checked the solution for f234e63, and I'm happy to report that the original issue has been resolved. Thank you for your diligent work on this! |
Hello,
First off, I want to express my appreciation for the Astrowind theme; it's fantastic, and your hard work is truly valued.
I'm currently applying Astrowind to a project in Chinese and have encountered some issues that I hope to get your guidance on:
When the
category
andtags
in the frontmatter of MDX files located insrc/content/post/
are in Chinese, the URLs for categories and tags are generated with syllable-based pinyin. For instance, the tag “数字技术” results in a URL likehttps://astrowind2.vercel.app/category/shu4-zi4-ji4-shu4
. How can I modify the code so that the URL appears ashttps://astrowind2.vercel.app/category/shu-zi-ji-shu
without the tone marks?On the blog post detail pages, such as
https://astrowind2.vercel.app/20240324-dong1-zhi4
, the URL includes syllable tone marks. How can I remove these tone marks from the URLs?Similarly, on the blog post detail pages (e.g.,
https://astrowind2.vercel.app/20240324-dong1-zhi
), both categories and tags are displayed in pinyin with tone marks. Is there a way to display them in Chinese, as per the frontmatter's categories and tags?Your advice on these matters would be greatly appreciated. You can view the code at https://github.com/zipziz/astrowind/.
Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered: