The Wicked Coder

PHP, fun and all

WordPress HTML Site Map without plugin

Before moving forward I would like to clarify the difference between “XML Sitemap” and “HTML Site Map”. So XML Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL, so that search engines can more intelligently crawl the site. Whereas HTML Site Map is an (X)HTML regular web page that can be read by any bot, and by regular web surfers (Humans) as well.

But I noticed that most of the bloggers avoids to add HTML Site Map in there blog site but they do submit there “XML Sitemap” to Google, bing, yahoo or any search engines so there blog pages get crawled, actually this is not good. As one should be kept in mind that web crawlers do also crawl through links so a site map is like a directory to the site with links for the web crawlers to follow.

In actual speaking submitting a Sitemap to the search engines is no guarantee that your pages will get indexed, and this is what each search engine do mentioned in bold letters while submitting the sitemap.

So the other good option you have with you is attract the bots and site visitors with an attractive HTML site map page of you website. Which not only helps the visitors to find and easy navigation facility but also helps bots to crawls each for your site pages.
Way to create SEO Friendly WordPress HTML Site Map

Here is the example Site Map page that you are going to get after following below steps

1. Prepare a sitemap template – Create a new .php file in your current activated theme folder and save it as sitemap.php
2. Past the below code in it




Posts

    ".$cat->cat_name."

    "; echo "
      "; query_posts('posts_per_page=-1&cat='.$cat->cat_ID); while(have_posts()) { the_post(); $category = get_the_category(); // Only display a post link once, even if it's in multiple categories if ($category[0]->cat_ID == $cat->cat_ID) { echo '
    • '.get_the_title().'
    • '; } } echo "
    "; echo ""; } ?>

Categories

Pages

    '', 'title_li' => '', ) ); ?>

3. Prepare a WordPress page through site Admin and name it as “Site Map” or what else you like.
4. Assign “Sitemap” template to this page

wordpress-assign-template-to-page

Go ahead and check your new site map page on your website

The Wicked Coder © 2014