Nuxt之Meta标签关键字描述之description重复问题
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                Nuxt之Meta标签关键字描述之description重复问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                
                            
                            
                            head: {titleTemplate: "網站標題",meta: [{ charset: "utf-8" },{ name: "keywords", content: "網站搜索關鍵字" },{name: "description", content: "網站描述" }]
} 
                        
                        
                        如上代碼,正常情況下輸入的網頁源代碼是這樣子的:
<head data-n-head=""><title data-n-head="true">網站標題</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width, initial-scale=1"><meta data-n-head="true" data-hid="description" name="description" content="My peachy Nuxt.js project"><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="keywords" content="網站搜索關鍵字"><meta data-n-head="true" name="description" content="網站描述"> </head>這樣子會有兩個description。
要解決這個問題很簡單,加上一個唯一標識hid:'description'
如下代碼:
head: {titleTemplate: "網站標題",meta: [{ charset: "utf-8" },{ name: "keywords", content: "網站搜索關鍵字" },{ hid: "description", name: "description", content: "網站描述" }] }輸入網頁源代碼為:
<head data-n-head=""><title data-n-head="true">網站標題</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width, initial-scale=1"><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="keywords" content="網站搜索關鍵字"><meta data-n-head="true" data-hid="description" name="description" content="網站描述"> </head>?
?
她那時候還太年輕,不知道所有命運贈送的禮物,早已在暗中標好了價格。
——斯蒂芬·茨威格《斷頭王后》
總結
以上是生活随笔為你收集整理的Nuxt之Meta标签关键字描述之description重复问题的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 每日学到 20 - 封装、访问修饰符
- 下一篇: 鸿蒙Ability(一):Feature
