WordPress's simplest Google sitemap

Source: Internet
Author: User
Tags google sitemap generator

I wrote a Google sitemap for my WP.
Enter sitemap directly using sitemap. php
Demo address: http://www.ccvita.com/sitemap.php
The Code is as follows:

require_once('wp-config.php');  mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Could not connect"); mysql_select_db(DB_NAME); mysql_query("SET NAMES ".DB_CHARSET);  header("Content-type: application/xml"); $query = mysql_query("SELECT ID FROM {$table_prefix}posts WHERE post_status = 'publish' ORDER BY ID DESC");  $xmlcontent = "< ?xml version=\"1.0\" encoding=\"UTF-8\"?>\n". "<!-- generator=\"http://www.ccvita.com/\"-->". "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";  while($item = mysql_fetch_array($query)) { $xmlcontent .= "<url>". "<loc>http://www.ccvita.com/$item[ID].html</loc>". "</url>\n"; }  $xmlcontent .= "</urlset>\n"; echo $xmlcontent; 

 

If your website is under the search engine, you need a more detailed sitemap file besides robots.txt. With sitemap, you can tell the search engine more directly to search for specified content.
For WordPress, it does not provide sitemap. You need to do it yourself. Generally, you need to use two types of sitemap: one is for the search engine to capture your webpage, and the other is for the browser to view.

This article describes several plug-ins that generate sitemap.
First, socialpatterns provides a simple method to save the provided code as sitemap. php, store it in the root directory of your website, and submit the path to Google. Address http://www.socialpatterns.com/search-engine-optimization/google-sitemaps-with-wordpress/

Type 2: Google sitemap Generator for WordPress is a WordPress sitemap plug-in that supports multiple languages. It provides sitemap in XML format. Download the plug-in first, upload it to your plugin directory, open the background management page, go to "Settings", and click "sitemap" to enter the settings.
After the configuration is complete, you can generate a sitemap. xml file in the site root directory (you need to set the path to generate the sitemap. xml file in advance. Generally, you can set it by default: store it in the site root directory. Then, you can submit it to Google or Yahoo. Address: http://www.arnebrachhold.de/2005/06/05/google-sitemaps-generator-v2-final

Third, set the "Site Map" for the website viewer to view and the sitemap submitted to Google. We recommend a classic plug-in: Dagon design sitemap generator. Address: http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/

 

Address: http://www.ccvita.com/171.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.