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

静态页面标题设置问题 #18

Open
RuofengX opened this issue Apr 13, 2022 · 1 comment
Open

静态页面标题设置问题 #18

RuofengX opened this issue Apr 13, 2022 · 1 comment

Comments

@RuofengX
Copy link

分类页面的标题如何设置?

图片

As you can see in the picture, the title of the html file is in english. If the title is generated by hexo, is there a way to customize it?
Let's say, I want to set the title as 画廊 but not /category/gallery, what should I do?

Begging for your reply.

@zoeingwingkei
Copy link
Owner

zoeingwingkei commented Apr 19, 2022

你好,很抱歉目前 frame 的网页标题是固定的默认英文。目前如果你想自定义页面标题的话,可以前往 frame 主题文件夹路径下 layout/partials/head.ejs 文件中寻找以下代码:

var title = page.title;

if (is_archive()){
    title = __('Archive');

    if (is_month()){
        title += ': ' + page.year + '/' + page.month;
    } else if (is_year()){
        title += ': ' + page.year;
    }
} else if (is_category()){
    title = __('Category') + ': ' + page.category;
} else if (is_tag()){
    title = __('Tag') + ': ' + page.tag;
}

然后按照你自己的需要自定义 title 的内容即可。

另外,我会把自定义网页标题的功能加入到未来的 to-do list 里面,可能暑假时会完成一下🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants