You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def get_path(self, classification, lang, dest_type='page'):
"""Return a path for the given classification."""
if self.site.config['SLUG_AUTHOR_PATH']:
# Modified
if 'AUTHOR_CUSTOMIZED_SLUGS' in self.site.config and \
lang in self.site.config['AUTHOR_CUSTOMIZED_SLUGS'] and \
classification in self.site.config['AUTHOR_CUSTOMIZED_SLUGS'][lang]:
slug = self.site.config['AUTHOR_CUSTOMIZED_SLUGS'][lang][classification]
else:
slug = utils.slugify(classification, lang)
else:
slug = classification
return [self.site.config['AUTHOR_PATH'](lang), slug], 'auto'
Does this feature affect backwards compatibility? If yes, in what way?
Probably not. Just like post titles, user could choose to use or not to use customized slugs. Nikola should work as usual, if a user chooses not to use customized slugs. But I am not sure about translatable strings.
Rationale and full description: (why should it be added to Nikola?)
There is a very complicated issue in romanizing / slugifying Japanese. See Japanese Kanji is transliterated as Chinese in Frequently Asked Questions of Unidecode at https://github.com/avian2/unidecode
Due to the reason above, I found it difficult to write authors in Japanese. Of course I can write their names in English (romanization), but it’s just not perfect.
On the other hand, if I write their names in Japanese, their names will be either slugified using Chinese pronunciations (e.g. 山田太郎 -> shan-tian-tai-lang), which is totally wrong, or kept intact as Japanese, which causes %-escaped URLs.
To solve the issue, I have two suggestions.
Add customized slug for authors. If we can give an author called 山田太郎 a customized slug yamada-taro, then we can get a correct, simple URL yamada-taro (generated from customized slug), while seeing their real name in Japanese (the author name set in posts or BLOG_AUTHOR) in HTML.
Add translatable string for authors. If we can give an author called Yamada Taro a translation 山田太郎, then we can get a correct, simple URL yamada-taro (generated from Yamada Taro, the name set in posts or BLOG_AUTHOR), while seeing their real name in Japanese (generated from translated string) in HTML.
PS: Categories and tags in Japanese have similar issues, as you can see here https://org-technology.com/categories/index.html (科学技術計算 is slugified as ke-xue-ji-shu-ji-suan, instead of kagaku-gijutsu-keisan), but I haven’t looked into it so I’m not sure if there is already a solution for categories and tags.
Update: I have implemented customized slugs for authors. It seems to be the easier way of two, and it works fine for me.
The text was updated successfully, but these errors were encountered:
Requested Feature: Add Customized Slug or Translation for Authors
Related Area: authors, categories, tags, slug, unidecode, translatable
Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)
conf.py
plugins/task/authors.py
Does this feature affect backwards compatibility? If yes, in what way?
Probably not. Just like post titles, user could choose to use or not to use customized slugs. Nikola should work as usual, if a user chooses not to use customized slugs. But I am not sure about translatable strings.
Rationale and full description: (why should it be added to Nikola?)
There is a very complicated issue in romanizing / slugifying Japanese. See Japanese Kanji is transliterated as Chinese in Frequently Asked Questions of Unidecode at https://github.com/avian2/unidecode
Due to the reason above, I found it difficult to write authors in Japanese. Of course I can write their names in English (romanization), but it’s just not perfect.
On the other hand, if I write their names in Japanese, their names will be either slugified using Chinese pronunciations (e.g. 山田太郎 -> shan-tian-tai-lang), which is totally wrong, or kept intact as Japanese, which causes %-escaped URLs.
To solve the issue, I have two suggestions.
yamada-taro
(generated from customized slug), while seeing their real name in Japanese (the author name set in posts orBLOG_AUTHOR
) in HTML.yamada-taro
(generated from Yamada Taro, the name set in posts orBLOG_AUTHOR
), while seeing their real name in Japanese (generated from translated string) in HTML.PS: Categories and tags in Japanese have similar issues, as you can see here https://org-technology.com/categories/index.html (科学技術計算 is slugified as
ke-xue-ji-shu-ji-suan
, instead ofkagaku-gijutsu-keisan
), but I haven’t looked into it so I’m not sure if there is already a solution for categories and tags.Update: I have implemented customized slugs for authors. It seems to be the easier way of two, and it works fine for me.
The text was updated successfully, but these errors were encountered: