【发布时间】:2020-03-21 08:14:20
【问题描述】:
我看到 vuetify 项目有标题栏。但是 public/index.html 中的标题。 src 文件夹外
所以我很难让它动态化。每个页面必须有不同的标题。如果一样的话,对SEO的影响很大
我的 public/index.html 是这样的:
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>test-vuetify</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but test-vuetify doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
我该如何解决这个问题?我想让每一页的标题都不一样。根据页面内容
【问题讨论】:
-
您从哪里获取页面内容?它是硬编码的还是从某个数据库中提取的?如果它来自某个数据库,您只需像设置正文数据一样设置标题数据
-
@EGC 数据库中存在数据,存在数据是硬编码的
-
看起来你可以制作自己的组件来做到这一点:stackoverflow.com/questions/36612847/…
-
@Damian C 这种方法对 SEO 真的有用吗?如果我右键单击我的网站并选择
View Page Source,我会看到标题、描述、关键字不会改变。我看起来怀疑这种方式是否正确
标签: html vue.js vue-component url-routing vuetify.js