我有一个用Nuxt.js和Vue开发的新网站。根据Nuxt.js中的文档,我使用nuxt.config.js更新了首页的标题标签,并使用head属性声明了各个页面的标题和其他元描述。当我在本地测试时,每个页面的标题和元标记都不同。但是在生成静态站点并部署到AWS S3中之后,视图页面源中的所有页面标题和元信息都是在nuxt.config.js中声明的值。
我的Nuxt.config.js
export default {
mode: 'universal',/*
** Headers of the page
*/
head: {
title: 'My title for the website',meta: [
{ charset: 'utf-8' },{ name: 'viewport',content: 'width=device-width,initial-scale=1' },{ hid: 'description',name: 'description',content: 'This is my website' }
],
“个人Vue”页面中的Head属性。
export default {
head() {
return {
title: 'My Individual Page | My unique title',meta: [
// hid is used as unique identifier. Do not use `vmid` for it as it will not work
{
hid: 'description',content:
'My individual page and unique title'
}]