搜索引擎不按照description混亂生成頁面文字為搜索描述的解決辦法
網站經常會遇到搜索引擎不按照description描述生成描述搜索摘要,導致網站在SEO優化時缺失了很多參與排名的關鍵字和長尾詞流量,這個問題在國內搜索引擎非常普遍,但是穀歌搜索給出瞭解決這個問題,就是使用data-nosnippet HTM屬性說明哪些內頁文字不要生存搜索描述摘要。
我們可以指定不要使用HTML網頁的哪些文字部分生成描述摘要,使用 span、div和section元素中的data-nosnippet HTML屬性,在HTML元素級別實現這一點。
data-nosnippet被視為布爾屬性,與所有布爾屬性一樣,指定的任何值都將被忽略,爲了確保機器能讀懂,HTML 部分必須是有效的HTML,並且所有標記都有對應的結束標記。
例如:
<p>This text can be shown in a snippet<span data-nosnippet>and this part would not be shown</span></p>
<div data-nosnippet>not in snippet</div>
<div data-nosnippet="true">also not in snippet</div>
<div data-nosnippet="false">also not in snippet</div>
<!-- all values are ignored -->
<div data-nosnippet>some text</html>
<!-- unclosed "div" will include all content afterwards -->
<mytag data-nosnippet>some text</mytag>
<!-- NOT VALID: not a span, div, or section -->
這套data-nosnippet屬性除了可以運用到穀歌外,還可以用在bing搜索,國內搜索引擎目前沒有公佈支持,但是國內搜索引擎是充分參考穀歌搜索技術思路和HTML標準規範的,所以很有可能是有用的。
結語:如果你的網站出現搜索引擎生成的摘要不符合你設置,可以參考以上佈置,前提是不影響你網站的正常運行顯示。