-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Make it possible to set homepage title #2247
Comments
Contribtion welcome. Tip: remember to consider the locales support |
Are you working on it? I can help if you need @alizadeh118 |
I made a PR and honestly I didn't change a lot but it fixes the problem. |
As meteorlxy suggested above, could you make the default word 'Home' changed with locales? Just a suggestion. |
I'll work on it. |
I have checked the code and I'm not sure about something and I need your help. How should it exactly support locales for "Home" default title? I can imagine three options:
But the problem for both is that we already made it possible to set homepage title from home frontmatter
But I'm not sure about having such a big list in core only for support default Thank you in advance for you suggestions. |
i think 1 is not necessary, and 3 is what I want, any problem doing 2 such as cannot get the locale? |
There is no problem for getting the locale from default theme config (2nd scenario), but I mean if we want to obtain homepage title from user explicitly, we don't have to get it from theme config because we can get it from homepage frontmatter. So let's say we have a complete list of translations for {
"en": "Home",
"zh": "家"
} How should we find out the page (homepage) locale in
we have access to siteConfig and themeConfig and path :
Page {
_context: App {
siteConfig: {
locales: {
'/': {
lang: 'en-US',
title: 'VuePress',
description: 'Vue-powered Static Site Generator',
homepageTitle: 'Home',
path: '/'
},
'/zh/': {
lang: 'zh-CN',
title: 'VuePress',
description: 'Vue 驱动的静态网站生成器',
homepageTitle: '家',
path: '/zh/'
}
},
theme: '@vuepress/vue',
themeConfig: {
locales: {
'/': {
label: 'English',
selectText: 'Languages',
ariaLabel: 'Select language',
editLinkText: 'Edit this page on GitHub',
lastUpdated: 'Last Updated',
nav: [Array],
sidebar: [Object]
},
'/zh/': {
label: '简体中文',
selectText: '选择语言',
ariaLabel: '选择语言',
editLinkText: '在 GitHub 上编辑此页',
lastUpdated: '上次更新',
nav: [Array],
sidebar: [Object]
}
},
},
regularPath: '/',
relativePath: 'README.md',
path: '/'
} We can pass But I don't think it's a good idea and also I have no another! |
Feature request
What problem does this feature solve?
It gives the ability to change home page title.
What does the proposed API look like?
It's not going to change API.
How should this be implemented in your opinion?
Imagine you want to use homepage option so you set
home: true
then you search something that exist on homepage:It is shown as
Home
and you can not change homepage title because whenhome
istrue
it's hard coded and I don't know why:vuepress/packages/@vuepress/shared-utils/src/inferTitle.ts
Lines 12 to 14 in 7977532
Are you willing to work on this yourself?
Yes.
The text was updated successfully, but these errors were encountered: