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

Plugin for transliterate URLs #1479

Closed
chiliec opened this issue Aug 28, 2015 · 5 comments
Closed

Plugin for transliterate URLs #1479

chiliec opened this issue Aug 28, 2015 · 5 comments
Labels
enhancement New feature or request i18n

Comments

@chiliec
Copy link

chiliec commented Aug 28, 2015

Hey, guys!
I want to write plugin for transliterate urls (#506) and begin it in https://github.com/Chiliec/hexo-transliterator/blob/master/index.js.
I can write post.slug = translit(post.slug);, but this way works only for posts and pages. Please prompt me how I can rewrite links for categories and tags? Is it possible?

@Xuanwo
Copy link
Contributor

Xuanwo commented Dec 10, 2015

@chiliec Maybe we need to modify the content of md files.

And I'm confused by this feature.
What will happen if I own files like 你好,世界.md and Hello, world.md (after tansliterating, they are the same) ?

@chiliec
Copy link
Author

chiliec commented Dec 10, 2015

You're right, in this case both posts be linked to one. But nothing critical.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jan 14, 2016

Alright, when you are ready, pull your request, I will merge it in plugin list.

And I advice a tip to explain the state like #1479 (comment) .

@Xuanwo Xuanwo added the enhancement New feature or request label Jan 14, 2016
@leesei
Copy link
Member

leesei commented Feb 25, 2016

See hexo/lib/models/category.js (similarly for tag)

  Category.virtual('path').get(function() {
    var catDir = ctx.config.category_dir;
    if (catDir === '/') catDir = '';
    if (catDir.length && catDir[catDir.length - 1] !== '/') catDir += '/';

    return catDir + this.slug + '/';
  });

@stevenjoezhang
Copy link
Member

Any updates on this thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request i18n
Projects
None yet
Development

No branches or pull requests

4 participants