With the rise of search engines, The top-ranked sites draw a lot of traffic. Whether it's a search page ad or a search result, The degree of matching with the searcher's goals is relatively high (if the search engine is smart enough), so the visitor coming through the search engine is likely to get what he wants from the website And remember this site. That is, Search engines bring a lot of valuable traffic, So it's worth taking the time to optimize your wordpress blog for search engines. This article will share some wordpress seo tips for you.

I didn't spend much time doing search engine optimization before, Search engine inclusion is not very effective. Last February I finally did a seo for my blog and wrote this article. In the past year and a half, more SEO optimizations have been carried out, and blog posts have not been written much. The traffic has continued to increase, The site is back on pagerank 7, and it works pretty well. This time I updated the content of this article based on my wordpress seo scheme.

Optimize blog subtitles

Subtitle (slogan), called tagline in wordpress. It is not the same as a blog title, May carry some text describing the blog, Optimize it and use it. For example, my subtitle is "mg12" s blog-just another wordpress blog ", where the wordpress blog is set to h1. Because I want to tell the crawler, This is a blog about wordpress.

Differentiate page titles

The title of the page should not include the blog name. Wordpress titles generally use two parts:bloginfo ("name") and wp_title (). The former is the blog name. The latter is the title of the article (not displayed if the title does not exist). The classic theme and the default theme output the title code as follows.

<title>?php wp_title ("«", true, "right");?>?php bloginfo ("name");;</title>

The title structure of the output is "Article Title&Blog Name".

Unless your title and article content are more relevant, Otherwise such titles are obviously bad for seo. The title is one of the things that the crawler thinks is important, If the title contains information that is not relevant to the content of the article, How much will affect this page.

How should we do it?We can distinguish between different types of pages, My implementation code is as follows.

 //If it is the homepage and article list page, Show blog title
 if (is_front_page () || is_home ()) {
 bloginfo ("name");
 //If it is an article detail page and a separate page, Show article title
 } else if (is_single () || is_page ()) {
 wp_title ("");
 //If it is a category page, Show category description
 } else if (is_category ()) {
 printf ("Archives of categories for%1 $s", single_cat_title ("", false));
 //If it is a search page, Show search expressions
 } else if (is_search ()) {
 printf ("Search results for%1 $s", wp_specialchars ($s, 1));
 //If it is a tab page, Show label representation
 } else if (is_tag ()) {
 printf ("%1 $s tagged article archive", single_tag_title ("", false));
 //If it is a date page, Show date range description
 } else if (is_date ()) {
 if (is_day ()) {
  $title=get_the_time ("y n n j j");
 } else if (is_year ()) {
  $title=get_the_time ("y year");
 } else {
  $title=get_the_time ("y years n months");
 printf ("%1 $s article archive", $title);
 //Other pages show blog title
 } else {
 bloginfo ("name");

keywords and description

keywords provide core content contained in web pages for search engines, description provides a description of the web page for search engines. The theme I posted once included handling of keywords and description, but because of some seo plugin conflicts, It has been removed in newer versions. I believe that many of the so-called seo plugins for wordpress are not in place. Poor support for Chinese blogs, It may be better to modify it yourself.

Here are my rules for keywords, description and page title, The implementation method can refer to the description of the page title in the previous paragraph.

The description of the detailed page of the article generally takes the first 220 characters of the article. Specially important pages and articles can be customized with snippets, Make it more accurate. Use summary if summary information exists, Otherwise, the first 220 characters are used.The implementation code is as follows.

 if ($post->post_excerpt) {
 } else {
 //utf8_trim method is to escape the string before truncating characters, Avoid situations where half a character is intercepted
 $description=utf8_trim (substr (strip_tags ($post->post_content), 0, 220));
  • Previous Using the template engine in Express
  • Next Method for mutual conversion between unicode and ASCII in JavaScript