{"id":1845,"date":"2010-07-21T16:34:41","date_gmt":"2010-07-21T08:34:41","guid":{"rendered":"http:\/\/ygs.im\/?p=1845"},"modified":"2010-07-21T16:34:41","modified_gmt":"2010-07-21T08:34:41","slug":"%e4%b8%80%e6%97%a5%e4%b8%80%e6%8a%98%e8%85%be%e4%b9%8bwordpress-seo-%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/ygs.im\/?p=1845","title":{"rendered":"\u4e00\u65e5\u4e00\u6298\u817e\u4e4b WordPress SEO \u4f18\u5316"},"content":{"rendered":"\n<p>\u54c8\u54c8\uff0c\u53c2\u7167 <a href=\"http:\/\/www.neoease.com\/wordpress-seo-tips\/\" target=\"_blank\" rel=\"noopener\">WordPress SEO \u6280\u5de7<\/a> \u628a\u535a\u5ba2\u7ed9\u4f18\u5316\u4f18\u5316\uff0c\u53d7\u76ca\u532a\u6d45\uff0c\u532a\u6d45\u554a\u3002<\/p>\n\n\n\n<p>\u6298\u817e\u4e5f\u633a\u591a\u7684\uff0c\u5206\u5f00\u6765\u8bf4\u3002<\/p>\n\n\n\n<p><strong>1.\u6807\u9898\u4f18\u5316<\/strong><br>title \u4f7f\u7528\u6587\u4e2d\u7684\u65b9\u6cd5\uff0c\u4ee3\u7801\u5982\u4e0b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;title>&lt;?php if ( is_single() || is_page() || is_category() || is_tag() ) { wp_title(''); } else { bloginfo('name'); } ?>&lt;\/title><\/code><\/pre>\n\n\n\n<p>\u53bb\u6389\u6807\u9898\u524d\u7684\u9884\u7559\u7a7a\u683c\uff0c\u4ee3\u7801\u653e\u8fdb\u6a21\u677f function.php \uff0c\u683c\u5f0f\u4e3a &lt;?php \u4ee3\u7801 ?> :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function titledespacer($title) {\n\treturn trim($title);\n}\nadd_filter('wp_title', 'titledespacer');<\/code><\/pre>\n\n\n\n<p><strong>2.\u4e3a Read more \u52a0\u4e0a nofollow<\/strong><br>\u65b9\u6cd5\u8ddf\u4e0a\u9762\u7684\u4e00\u6837\uff0c\u4e5f\u662f\u52a0\u5230 function.php\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter('the_content_more_link','nofollowReadMore' ,0);\nfunction nofollowReadMore($link) {\n\treturn str_replace('class=\"more-link\"', 'class=\"more-link\" rel=\"nofollow\"', $link);\n}<\/code><\/pre>\n\n\n\n<p><strong>3.Keywords &amp; Description<\/strong><br>\u7c7b\u4f3c\u7684\u63d2\u4ef6\u5f88\u591a\uff0c\u6211\u53ea\u7528\u8fc7 Simple Tags\uff0c\u89c9\u5f97\u4e0d\u592a\u5982\u610f\u3002\u540e\u6765\u79fb\u690d\u4e86\u67d0\u4e2a\u4e3b\u9898\u7684\u4ee3\u7801\uff0c\u518d\u540e\u6765\u5728\u67d0\u4e2a\u535a\u5ba2\u770b\u5230\u7684\u4ee3\u7801\uff0c\u73b0\u5728\u662f\u6839\u636e\u4e0a\u6587\u7684\u6280\u5de7\u6539\u5199\u7684\u4ee3\u7801<del datetime=\"2010-07-21T09:58:57+00:00\">\uff0c\u53ea\u662f\u8fd8\u6ca1\u5b8c\u6210\u9875\u9762\u7684 Description \uff0c\u52a0\u4e0a\u6211\u53ea\u6709\u2018\u5173\u4e8e\u2019\u4e00\u4e2a\u9875\u9762\uff0c\u90a3\u5c31\u6682\u65f6\u5ffd\u7565\u4e86\uff0c\u5475\u5475<\/del>\u3002\u7ecf\u8fc7\u6298\u817e\uff0c\u4ee3\u7801\u5df2\u57fa\u672c\u5b8c\u7f8e\u4e86\uff0c\u5206\u7c7b\u9875\u7684 description \u662f\u5206\u7c7b\u63cf\u8ff0\uff0c\u8981\u540e\u53f0\u6dfb\u52a0\u3002\u5b8c\u6574\u4ee3\u7801\uff0c\u653e\u5230 head \u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php if (is_home()){\n$description = \"Ygs' blog\u4ee5\u6c11\u95f4\u6298\u817e\u4e3a\u4e3b,\u4e2a\u4eba\u751f\u6d3b\u4e3a\u8f85,\u524d\u7aef\u8bbe\u8ba1\u4e3a\u76ee\u7684\u7684\u4e2a\u4eba\u535a\u5ba2\";\n$keywords = \"YGS,WordPress,\u524d\u7aef\u8bbe\u8ba1,\u4ea4\u4e92\u8bbe\u8ba1,\u7528\u6237\u4f53\u9a8c\";\n} elseif (is_single()){\nif ($post->post_excerpt) {\n$description = $post->post_excerpt;\n} else {\n$description = mb_substr(strip_tags($post->post_content),0,220,'utf-8');\n$description = str_replace(array(\"rn\", \"r\", \"n\",\" \",\"\t\"), \" \", $description);\n}\n$keywords = \"\";\n$tags = wp_get_post_tags($post->ID);\nforeach ($tags as $tag ){\n$keywords = $keywords . $tag->name . \", \";\n}$keywords = substr($keywords,0,-2);\n} elseif(is_category()){\n$description = strip_tags(category_description());\n} elseif(is_tag()){\n$description = \"\";\n$tags = wp_get_post_tags($post->ID);\nforeach ($tags as $tag ){\n$description = $description . $tag->name . \", \";\n}$description = substr($description,0,-2);\n} elseif(is_page()){\n$description = $post->post_title ;\n} else {\n$description = \"\";}?>\n&lt;?php if (is_single()||is_home()) {?>\n&lt;meta name=\"keywords\" content=\"&lt;?=$keywords?>\" \/>\n&lt;meta name=\"description\" content=\"&lt;?=$description?>\" \/>\n&lt;?php } ?>\n&lt;?php if (!is_single()&amp;&amp;!is_home()) {?>\n&lt;meta name=\"keywords\" content=\"\" \/>\n&lt;meta name=\"description\" content=\"&lt;?=$description?>\" \/>\n&lt;?php } ?><\/code><\/pre>\n\n\n\n<p>\u53d1\u73b0\u6700\u540e\u7684 elseif \u4e0d\u4f1a\u7528\uff0c\u53ea\u80fd\u5206\u5f00\u4e24\u4e2a\u5224\u65ad\u8bed\u53e5\uff0c\u6548\u679c\u4e00\u6837\uff0c\u56e7\u3002<br>\u6b64\u4ee3\u7801\u57fa\u672c\u7b26\u5408\u4ee5\u4e0b\u89c4\u5219\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u9875\u9762\u7c7b\u578b<\/th><th>Keywords<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>\u9996\u9875<\/td><td>\u81ea\u5b9a\u4e49 keywords<\/td><td>\u81ea\u5b9a\u4e49 description<\/td><\/tr><tr><td>\u6587\u7ae0\u9875\u9762<\/td><td>\u6807\u7b7e\u7ec4\u5408<\/td><td>\u6458\u8981\u6216\u8005\u6587\u7ae0\u524d 220 \u4e2a\u5b57\u7b26<br>(\u622a\u53d6\u6587\u7ae0\u9700\u8981\u7279\u6b8a\u5904\u7406\u5168\u89d2\u5b57\u7b26)<\/td><\/tr><tr><td>\u641c\u7d22\u9875\u9762<\/td><td>&#8211;<\/td><td>\u641c\u7d22\u5173\u952e\u5b57<\/td><\/tr><tr><td>\u5206\u7c7b\u5b58\u6863\u9875\u9762<\/td><td>&#8211;<\/td><td>\u5206\u7c7b<\/td><\/tr><tr><td>\u6807\u7b7e\u5b58\u6863\u9875\u9762<\/td><td>&#8211;<\/td><td>\u6807\u7b7e<\/td><\/tr><tr><td>\u65e5\u671f\u5b58\u6863\u9875\u9762<\/td><td>&#8211;<\/td><td>\u65e5\u671f<\/td><\/tr><tr><td>\u5176\u4ed6\u9875\u9762<\/td><td>&#8211;<\/td><td>\u9875\u9762\u6807\u9898<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>4.\u5c06 Related Post \u6539\u4e3a More posts about XXX<\/strong><br>\u4e5f\u5c31\u662f\u5c06\u201c\u76f8\u5173\u6587\u7ae0\u201d\u6539\u4e3a\u201c\u4e0eXX\u6709\u5173\u7684\u6587\u7ae0\u201d\uff0c\u6211\u4f7f\u7528\u4e86\u6587\u7ae0\u7684\u6807\u7b7e\u4ee3\u66ffXX\uff0c\u5177\u4f53\u6a21\u677f\u5177\u4f53\u5206\u6790<br>\u83b7\u53d6\u6807\u7b7e\u51fd\u6570 the_tags(&#8221;, &#8216;, &#8216;, &#8221;);<\/p>\n\n\n\n<p>\u57fa\u672c\u5c31\u8fd9\u4e48\u591a\u4e86~\u4f7f\u7528\u6109\u5feb~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u54c8\u54c8\uff0c\u53c2\u7167 WordPress SEO \u6280\u5de7 \u628a\u535a\u5ba2\u7ed9\u4f18\u5316\u4f18\u5316\uff0c\u53d7\u76ca\u532a\u6d45\uff0c\u532a\u6d45\u554a\u3002 \u6298\u817e\u4e5f\u633a\u591a\u7684\uff0c\u5206\u5f00\u6765\u8bf4\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-1845","post","type-post","status-publish","format-standard","hentry","category-note"],"_links":{"self":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts\/1845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1845"}],"version-history":[{"count":0,"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts\/1845\/revisions"}],"wp:attachment":[{"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}