当前位置:网站首页>Nuxt 所有页面都设置上SEO相关标签
Nuxt 所有页面都设置上SEO相关标签
2022-08-02 23:36:00 【真是远胜貌似】
前言
优点:一次性配置,多组件共用。
步骤很简单:在nuxt.config.js中进行配置,配置完所有组件的head标签内都共用一套seo优化配置,非常的奈斯。
代码展示
export default {
head: {
title: "网易云音乐",
htmlAttrs: {
lang: "en",
},
meta: [
{
charset: "utf-8" }, // 字节编码
{
"http-equiv": "X-UA-Compatible", content: "IE=edge,chrome=1" }, // 浏览器优先打开谷歌和edge
{
"http-equiv": "Cache-Control", content: "no-transform" },
{
name: "viewport", // 禁止移动端缩放
content:
"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
},
{
name: "author", // 网站作者
content: "网易云音乐",
},
{
name: "keywords", // 网站关键字
content:
"网易云音乐,音乐,播放器,网易,下载,播放,DJ,免费,明星,精选,歌单,识别音乐,收藏,分享音乐,音乐互动,高音质,320K,音乐社交,官网,music.163.com",
hid: "keywords",
},
{
hid: "description", // 网站描述
name: "description",
content:
"网易云音乐是一款专注于发现与分享的音乐产品,依托专业音乐人、DJ、好友推荐及社交功能,为用户打造全新的音乐生活。",
},
{
name: "format-detection", content: "telephone=no" },
// og是一种新富媒体对象,简言之就是新seo优化手段
{
property: "og:title", content: "网易云音乐" }, // 网站标题
{
property: "og:image", // 网站logo图
content: "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
},
{
property: "og:type", content: "website" }, // 类型为网站
{
property: "og:url", content: "https://www.baidu.com/" }, // 网站首页
{
property: "og:site_name", content: "网易云音乐" }, // 网站名称
],
link: [
{
rel: "icon",
type: "image/x-icon", // 网站名称旁边的小logo,例如csdn的图标c
href: "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
},
],
},
};
效果展示

首页

子页面
后话
后续如果还有更多干货会持续更新,只要有整理很快会就发布,希望对你有所帮助,感谢阅读。
边栏推荐
猜你喜欢

Mock工具之Moco使用教程
Teach you to locate online MySQL slow query problem hand by hand, package teaching package meeting

华为设备配置BFD与接口联动(触发与BFD联动的接口物理状态变为Down)

Connect the Snowflake of CKAN tutorial CKAN to release to open data portal

Apache Doris 1.1 特性揭秘:Flink 实时写入如何兼顾高吞吐和低延时

如何突破测试/开发程序员思维?一种不一样的感觉......

Merge two excel spreadsheet tools

我们来浅谈代码语言的魅力

别再到处乱放配置文件了!我司使用 7 年的这套解决方案,稳的一秕

可编程逻辑控制器(PLC) : 基础、类型和应用
随机推荐
flutter 时间戳转日期
【UE5 骨骼动画】全形体IK导致Two Bone IK只能斜着移动,不能平移
4、Citrix MCS云桌面无法安装todesk等软件
分库分表索引设计:二级索引、全局索引的最佳设计实践
Apache Doris 1.1 特性揭秘:Flink 实时写入如何兼顾高吞吐和低延时
合并两个excel表格工具
程序员常说的“左手锟斤拷,右手烫烫烫”是怎么回事?
Test | ali internship 90 days in life: from the perspective of interns, talk about personal growth
D experimental new anomaly
浅谈I2C知识
用了TCP协议,就一定不会丢包吗?
Technology Sharing | How to do assertion verification for xml format in interface automation testing?
如何修复 SAP UI5 aggregation with cardinality 0..1 相关的错误消息
我们来浅谈代码语言的魅力
js基础知识整理之 —— 五种输出方式
NLP常用Backbone模型小抄(1)
D with json
思源笔记 本地存储无使用第三方同步盘,突然打不开文件。
TensorFlow学习记录(一):基本介绍
我为什么又能面试一次就拿到offer