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

Hexo分类和标签的路径怎么设置成英文 #1162

Closed
ghost opened this Issue Apr 2, 2015 · 6 comments

Comments

5 participants
@ghost
Copy link

ghost commented Apr 2, 2015

Hexo分类和标签的路径怎么设置成英文??

比如说我点分类“Linux操作系统”后的路径是:
http://localhost:4000/categories/Linux操作系统
我想设置成英文的URL,可以像 permalink 的 id自动生成,或者能不能给每个分类设置个英文的别名,只用于URL。
因为我的主机不支持中文字符的URL,一直报404。
可以到 http://www.eurry.net/
看看,一点分类就报404

@gejiawen

This comment has been minimized.

Copy link

gejiawen commented Apr 2, 2015

以下纯属个人猜测,

你可以修改{theme-name}/_config.yml中关于链接的内容,比如,

menu:
  首页: { id: index, url: / }
  归档: { id: archives, url: /archives }
  分类: { id: categories, url: /categories }
  标签: { id: tags, url: /tags }
  阅读: { id: reading, url: /reading }
  实验室: {id: labs, url: /labs }
  关于: { id: about, url: /about }

然后在模版中,

<% for(var key in theme.menu) { %>
    <li id="nav-<%- theme.menu[key]['id'] %>">
        <a href="<%- theme.menu[key]['url'] %>"><%= key %></a></li>
<% } %>
@PlatypusPro

This comment has been minimized.

Copy link

PlatypusPro commented Apr 2, 2015

似乎在_config.yml# Category & Tag一项下面的tag_mapcategory_map下面这样写就行了吧

# Category & Tag
default_category: uncategorized
category_map: 
    Linux操作系统: Linux-OS
    中文分类: 英文分类
tag_map:
    中文标签: 英文标签
@ghost

This comment has been minimized.

Copy link
Author

ghost commented Apr 2, 2015

真的,这样设置一下就可以了,谢谢楼上

@ghost ghost closed this Apr 2, 2015

@NewbMiao

This comment has been minimized.

Copy link

NewbMiao commented Oct 15, 2015

为什么我试了不行呢,hexo3.1.1,mac

@w138789

This comment has been minimized.

Copy link

w138789 commented May 25, 2016

看这个文件_config.yml的编码是不是UTF-8的,要设为这个编码才行

@DeppWang

This comment has been minimized.

Copy link

DeppWang commented Jul 14, 2017

PlatypusPro 解决了我的问题,感谢

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment