When using a custom theme via .vuepress/theme/Layout.vue, config variables title and description specified in .vuepress/config.js are not rendered in the dist/index.html file.
Can you provide the repro repo?
It's implemented in default theme, not in core.
Copy the related code from Layout.vue of default theme.
(So I proposed to extract them into mixins for better reuse #314 . Consider merging it? @ulivz :smiley: )
Maybe we should put the code above to core, as it's necessary for the ssr template:
https://github.com/vuejs/vuepress/blob/5e87b657499fbe44d6bd71bdb6b343e41faa6b5e/lib/app/index.ssr.html#L1-L17
@pavloko Do you have any locale set?
Notice that if you have something like this:
title: 'Hello',
description: 'World',
locales: {
'/': {
lang: 'en-US',
title: 'VuePress',
description: 'Vue-powered Static Site Generator'
},
'/zh/': {
lang: 'zh-CN',
title: 'VuePress',
description: 'Vue 椹卞姩鐨勯潤鎬佺綉绔欑敓鎴愬櫒'
}
}
The locale will have precedence and that may be the reason of your problem...
It is worth mentioning that with the field description it even has more precedence any value in a page's Front Matter.
No any reproduced link, all the "conclusions" will be inconclusive.
Hey guys, sorry for not providing this from the start. Here's the repo.
@whoan this is not the case, please check out the example.
@meteorlxy suggestion worked.
It was confusing that including head tags worked fine (you can see this in example repo), but title and description.
I see that #314 have been merged now (great work) and it seems that now to render title and description in a custom theme, Layout.vue should include something like:
import { updateMetaTags } from '@default-theme/mixins'
export default {
mixins: [updateMetaTags]
}
However, coming back to the fact that config.head is included in the built despite any changes in Layout, is there any reason why we can't do the same for title and description? It seems a bit counterintuitive to include the mixin just to render title and description.
@pavloko Yes, that's the point, so I mentioned:
Maybe we should put the code above to core, as it's necessary for the ssr template:
I would create a PR for that, but there is another problem, see #296 .
In #296, I wonder whether should we restrict $title in core.
In this issue, we are going to restrict this.$ssrContext.title = this.$title in core. Uh what a mess!
(Hmmm, #314 has not been merged yet, I think)
Hey @meteorlxy! Sorry, missed that line between the code blocks. I shared my thought in #296.
I'd agree that any head modifications should belong to core/config.
@pavloko Now the title, description and lang will be rendered at not only default theme but also custom themes.
Fixed at fcaee80358d47a26753eae49979a2047757a1fd8. and it will be released it at 0.9.0.