How to create a sitemap page for WordPress blog

Well it’s a long-time for me to comeback after many busy works at my company :), so, in this post I wanna to show you how to create a sitemap page for your WordPress blog without any additional plugin. If your web blog doesn’t have this page, lets try this simple tip with me.

First, why should your website have a sitemap page?

As a blogger, I think all of you are know about the importance of the sitemap page and therefore: the Google XML Sitemaps plugin for WordPress was downloaded 4,385,535 times (according to figure), of course I don’t want to talk about it again but most of bloggers aren’t create a sitemap page for their visitor and it’s a big missing! An XML sitemaps will help the SE index your website more easily but your website visitors almost never view that page and they need a page to scan all of your blog posts. (In addition, this page will help to increase the inbound linking for your site)

And how to make it?

There’s just a few simple step:
1/ Locate to your WordPress theme folder and make a copy of the page.php file, rename the new one is sitemap.php.
2/ Edit sitemap.php file:

<?php the_content(); ?>


<ul><?php wp_list_pages("title_li=" ); ?></ul>
<li><a title="Full content" href="feed:<?php bloginfo('rss2_url'); ?>">Main RSS</a></li>
<li><a title="Comment Feed" href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comment Feed</a></li>
<ul><?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0&feed=RSS'); ?></ul>
<h3>All Blog Posts:</h3>
<ul><?php $archive_query = new WP_Query('showposts=1000&cat=-8');
while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
(<?php comments_number('0', '1', '%'); ?>)
<?php endwhile; ?>
<?php wp_get_archives('type=monthly&show_post_count=true'); ?>

3/ Add the following code on top of sitemap.php file:

Template Name: Sitemap

4/ Login to your WordPress admin panel, create a new page with any Page title as you want.

In the Page Attributes box, choose sitemap template and then publish this page. It’s done!

84 thoughts on “How to create a sitemap page for WordPress blog”

  1. Pingback: 140+ Highly Useful Articles for Web Designers and Developers — tripwire magazine

  2. Pingback: Roundup: Best Design related articles Septeber 10

  3. I agree with you. Not all bloggers uses site map. I’ve seen so many blogs that only use category listing and archive listing for their blogs so that their readers can locate their posts easily. But not as easy as having a site map added into your site.

  4. Hmm, I started to follow your directions and created a page first. I wanted to see what templates were in there.. To my amazement, there was a Site Map template in the drop down already. I wonder if that is new for WordPress 3x or if I once installed a plugin then removed it when I could not figure out how to use it? haha. No idea how it got in there.. But selected it and my sitemap was up and running within seconds.

    1. No, actually some themes already have sitemap page built in it.
      It depends on the developer, and it doesnt matter whether the theme is a free theme or the premium one.

  5. Thank you so much for the simple instructions on how to make a sitemap in wordpress! I had already created my xml sitemap but I wanted to create one for my users to find stuff quickly. I know that when I am on a site that looks like it has a lot of pages I am either going straight to the search bar or the sitemap. :) Thanks again and please keep up the great work!

  6. Although there a lot of plugins that automatically does this job for us, I would definitely still go for this one.

    Nice Tutorial Jennifer :D

  7. Sitemap is a very important thing in a blog. Like what other bloggers keep on telling, search engines love it, Google absolutely love those blogs with sitemap. It’s great that you remind it to us.

  8. Jennifer, i already had a plugin doing this job, But which one do u prefer? Creating it manually or letting the plugin do the job? Please advice


  9. Hi Jeniffer. Thanks a lot for the tuts. It works like a charm on my site. I just want to know, why the status of my sitemap on Google webmaster is X but there is url been index?? Do you know what’s the problem?

  10. Julius-Money Maker Sites

    Thanks Jeniffer for sharing what you know here. I did created my sitemap once and not really into the right place. I will do over with your tutorial…

  11. abdulrahman nahas

    thank you for this lesson. I had a problem. I make a site map but my site map dont show my last posts. how I can solve it…

  12. The procedure is easy to follow and most important – works. Thank you very much for sharing this useful procedure.

  13. I always had used plugins which automatically update itself. You can also set the priority for deep links. I also recommend using a xml sitemap creator for the archives section of your site.

  14. Nice tutorial. I was just creating a site map page and didn’t even think about adding the feeds in here. Nicely done ;)

  15. Hi. Thank you for this… so simple. I do have one small issue that I’m hoping you can help me with. When I go to my blog and click on “Sitemap,” the sitemap comes up very nicely just like you have here on your site. However, if I click on a menu (category) on my horizontal menu bar, I get a 404 page. Though I can click on my blog’s home page or any menus with an external link and be taken to the appropriate place. It’s just the menu links for my internal categories that is having the issue. However, if I go to the Home page on my blog and then click the menu links, I am taken to where I should be. The only time I have an issue is within the Sitemap page. Yet again, I can click on the same category links in my sidebar, and I am taken to the appropriate place. I don’t want my readers coming in and getting frustrated if they decide to click on a menu link rather than a link given by the sitemap. I’m sure it’s just a small piece of coding that can fix this. Can you please help me?

  16. Hey, thanks for being there for me tonight…I really needed some help on my Sitemap, because I don’t have one. My buddy said I needed one so I Google and got your find answer. However, I don’t know how to use code at all right now, so I’m doing more homework to get that sitemap up on my page.t

  17. Been looking all day and then some for EXACTLY what your blog did for me. THANK YOU!!!!!!!

    Now…if you had a High Slide trick or two you could pass along. :)

    Thanks again, Mike

  18. Thank you thank you thank you! I’ve tested a bunch of XML sitemap generators, fine for the search engines, but found none that worked as well as for site visitors. Thank you. Now visitors can see all blog posts and I don’t need to keep manually editing an html sitemap each time I add new posts (or worse, when i change or edit themes). This keeps track of posts et al for me.


  19. I have wordpress installed on a subdirectory of my website, so it’s at www . mysite . com / blog and it works great. I have a sitemap fr my main website which I update manually, but am not sure what to about the sitemap for my wordpress blog because of how it’s set up. Do I just add the blog posts to my main sitemap like my other website pages, or shold install a sitemap plug in? I’m confusd as to what would be a better move SEO-wise…

    1. Hi Dan, as what you say, I assume that your main website is not powered by WordPress. I think it’s necessary that there’s only 1 sitemap page for a website therefore, you need to add the blog posts to my main sitemap.

  20. Hey Jenni, thanks for this tutorial.

    You could also add a list of authors to this template, would be useful if it’s a multi author blog.

  21. Hello

    It’s quite useful code. Now, can you pls explain to add ‘sub-categories’ under ‘main-categories’ and to add ‘author’ list in sitemap.


    1. Hi Ashish, as I noticed that the wp_list_cats() function has been deprecated and be replaced with wp_list_categories()

      You can view that page and change the “depth” to 0, it would show all categories and their sub-categories.

      About the author list, you can use this function wp_list_authors()

  22. hi Jenni,
    I use your code on my site it was working fine but now i am getting error message-
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64 bytes) in /home2/fabricd3/public_html/designersbrush/wp-includes/meta.php on line 339

    Any idea what is wrong with it, thanks for your help.

    1. As this error I think this’s a problem with your host so you can contact them about it, maybe it allows too few memory for your site.

  23. Thanks Jenni, it’s really helpful post but why do we need to create a separate XML Sitemap Page? I know you gave the answer above but what I am asking is you can submit your sitemap without creating a page right? So why it’s necessary to create new page just for sitemap?

  24. Thanks you for sharing information, I find it helpful by this article to create a sitemap in WordPress an easier without must using a plugin that overload the server’s performance.

  25. i really like your idea of putting categories, blog posts, archives, pages and number of post per category in a single page but how can i show only categories on a page for ex. lets say i have a celebrity blog now i want a page which have Celebrities as heading than alphabet “A” and under this all the celebrities staring with the alphabet “a” and so on.

  26. Hey, thank you for this nice sitemap. I use multisite on my wordpress and this helps me a lot. But my site have posts about 2000 so it will not cause any problem right? like taking too much time for loading sitemap???

  27. A good sitemap helps your visitors find faster and easier what they’re searching for and, at the same time, allows the search engines to crawl your website faster. As for the HTML map, take care to check it before uploading it. The generator creates the map following the crawling instructions you give the search spiders in your robot.txt file. “Rebuild sitemap if you change the content of your blog” is checked so that it updates automatically.

  28. Hi .. first of all , I want to give thanks for this useful post . A sitemap is the thing that works behind the webpages to get indexed in search engines .Previously , I used to use Google XML Sitemap Generator Plugins for WordPress .but after some time I got problem from it .However , it stopped responding for me and don’t know why it did so . after that , I tried to create sitemap manually . But it was not only boring but also laborious job for me . So I tried to submit my RSS feed as my sitemap in web masters tool in Google. But there is a problem with the old blog pages because they are not properly indexed . However , I tried a xml sitemap generator for my site ..even I wrote an article about it .. here is the link .. any one can check it too .. “ ” …Thnx again ..:)

  29. Simple but intructive…How i wish i could migrate soon from blogger to wordpress..thanks for the info…honestly, i’ll keep on exploring about wordpress for quite sometime now…

  30. I made a site map for my blog using this method, But once I tried to submit it to Google webmaster tools it says, the site map is in HTML form and not supported by Google. Is there any solution for this??

    1. This type of sitemap is not for Google Webmaster submitting, it’s only for your “real” visitors.

  31. Firstly, I wanna thank you for this helpful post you’ve made. I’m currently searching on how to create a sitemap for my site then I stumbled upon in your blog, this is a great yet simple but effective. Thank you for this. :)

  32. We have been using Dagon Design Sitemap Generator for years… Definitely like your organization better. Great write up! Will be implementing soon.

  33. It is a good post, thanks for sharing valuable pieces of advice here. I am using Google sitemap generator right now and it is working pretty well, can you tell me how to make a text sitemap and if it’s necessary to make it for your blog. Will appreciate it, thanks

  34. Nice and informative article

    Although there are many plugins which can be used to generate sitemap, this type of creating sitemap using coding is also a nice way.

    Thank you for sharing such a article .

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top