vue .js动态页面标题
尝试根据VUEJS项目中的URL参数更改页面标题。
在路由器中
具有缠绕路径:
{
path: '/:location',
name: 'home_spec',
components: { default: Home, header: StarterNavbar, footer: StarterFooter },
}
并将位置推入路由器中的标题:
router.beforeEach((to, from, next) => {
if (to.params.location){
document.title = `${to.params.location}`
}else{
document.title = "Default title"
}
next()
})
in index.html
具有
<title><%= htmlWebpackPlugin.options.title %></title>
,并且效果很好(TAB具有可见的可见title)但 surececode(ctrl+u)具有默认标题,如包JS名称参数所示。
是否可以在水疗中心发送带有理想标题的第一个HTML页面? 如果答案是否定的,那么SEO对于搜索机器人至关重要?
Trying to change page title depending on URL params in VueJS project.
In router
have the folowing path:
{
path: '/:location',
name: 'home_spec',
components: { default: Home, header: StarterNavbar, footer: StarterFooter },
}
and pushing location to title also in router:
router.beforeEach((to, from, next) => {
if (to.params.location){
document.title = `${to.params.location}`
}else{
document.title = "Default title"
}
next()
})
in index.html
have
<title><%= htmlWebpackPlugin.options.title %></title>
And it works fine (tab has desireable title ) BUT sourcecode (CTRL+U) has the default title as in the package,js name parameter.
Is it possible to send the first html page with the desirable title in SPA?
If the answer is no, what about SEO is it critical for searching robots?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许尝试另一种设置页面标题的方式?例如,您可以做:
Maybe try another way of setting page title? for example u can do: