第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 WordPress 上僅排除空頁面被 Google 索引

如何在 WordPress 上僅排除空頁面被 Google 索引

PHP
慕慕森 2023-06-24 17:33:16
我已經(jīng)在 WordPress 上創(chuàng)建了超過 10k 的頁面,為了避免 Google 因內(nèi)容稀薄而受到 Panda 懲罰,我所做的是將 JavaScript 代碼放在 Loop-page.php 上,并檢查頁面是否沒有內(nèi)容并添加了元數(shù)據(jù)禁止抓取頁面的標簽,但它并不總是有效。這是我添加的代碼。<?php if($post->post_content=="") { ?><p>We are still updating our website with contents. Please check back next time.</p><script>    (function(){        var meta = document.createElement("meta");        meta.setAttribute("name",  "robots");        meta.setAttribute("content",  "noindex, nofollow");        document.head.appendChild(meta);                var meta2 = document.createElement("meta");        meta2.setAttribute("name",  "googlebot");        meta2.setAttribute("content",  "noindex");        document.head.appendChild(meta2);    })()</script>您能給我一個正確執(zhí)行此操作的想法嗎?當 Google 抓取頁面時,我的 JavaScript 似乎無法運行,順便說一句,我正在使用 SEO Ultimate 插件
查看完整描述

1 回答

?
當年話下

TA貢獻1890條經(jīng)驗 獲得超9個贊

元標記需要進行硬編碼才能發(fā)揮作用。如果您想動態(tài)創(chuàng)建元標記,則需要在服務(wù)器端進行。使用 PHP:


if(!pageHasContent){

  echo "<meta name='robots' content='noindex, nofollow' />";

  echo "<meta name='googlebot' content='noindex' />";

}


查看完整回答
反對 回復(fù) 2023-06-24
  • 1 回答
  • 0 關(guān)注
  • 124 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號