31
A sitemap is always great to have. DoDesign has a sitemap at dodesign.us/sitemap. It lists doDesign’s blog posts, designs, portfolio, pages, and RSS Feeds. Sitemaps are good to have for many reasons. First of all, they are good for navigation. They help visitors find the page they are looking for. Second, they are good for search engine rankings. They help search engines find pages to crawl. Finally, they organize your site. Sitemaps can be divided into sections, categories, or whatever you think is best.
There are many WordPress Plugins that automatically generate sitemaps, but none of these are perfect. To be honest, it is best to create one manually. Luckily, WordPress is flexible enough to let you do just that. Once set up, new posts will automatically appear on the sitemap.
It’s fairly easy to do, but definitely helps to know HTML. The first thing you need to do is create a file called sitemap.php. Copy and paste the following to the top of the file:
Create the layout for your page below that. Since I didn’t want my sidebar to appear, I copied and pasted the contents of header.php, index.php, and footer.php into one page. For now, just put anything on this page and upload it to your WordPress theme’s directory. We need to create a page in WordPress.
Head over to your WordPress Admin Panel and create a new page. Call the page “Sitemap,” and change the page’s template to Sitemap (see image). If that doesn’t appear, make sure you uploaded sitemap.php correctly. Save the page and visit it.
If everything worked right, you’ll see the page you created. It might not have anything on it, but that’s okay.
Great, It’s working!
Reopen sitemap.php and we’ll get started. Every site is different so it’s up to you to decide how you want to organize the sitemap. For doDesign, I categorized everything into blog posts, designs, portfolio posts, pages, and RSS Feeds.
Below are some different scenarios. After each post, the post’s date will be shown, but it can be easily removed.
Posts
Listing the posts is the most important part. Posts are where the content lives, so it’s crucial that search engines find them. There are endless ways of listing posts.
List all Posts
This code will list all posts in alphabetical order.
List all Posts – Newest Posts First
List all recent posts, but show the newest posts first.
List all Posts – In A Category
This code will list all posts from a specific category in alphabetical order. Change the category ID in line 2.
If you want to use the category name instead of ID, use the following code:
List all Posts – With a Certain Tag
This code will list all posts with a tag of your choice. If you use multiple tag slugs separated by commas, all results matching any tag will be returned. If you use multiple tag slugs separated by spaces, the results will match all the specified tag slugs.
List all Posts – By Author
If you want to divide the posts by author, use the code below.
Pages
Obviously, pages are an important part of any site. Many sites, doDesign included, have an About page and certainly a Contact page.
List all Pages
This will list all pages in alphabetical order. Unlike the posts, pages won’t include the date. Sub-Pages will also be listed under the parent page.
List all Pages – By Page Order
Tags
Tags are an important part of many sites. They can easily describe your content and are like clickable search terms. They help visitors find related posts and are very useful to plugins like YARPP. I use tags on doDesign to group designs together. For example, the “green” tag shows all green designs.
List all Tags
In the default code, tags are listed horizontally like this and the font size changes depending on the tag’s popularity. Unfortunately, you need to manually specify the font size and unit. Make sure that it is the same size as the other links in your sitemap otherwise it might look out of place.
List all Tags – Tag Cloud
By default, WordPress will generate a tag cloud. Tags used the most will be the largest. You can specify a tag’s size, color, and much more.
Take a look at this page for more detailed information.
Categories
Some people use categories, others use tags, but some use both. I use categories as variables of sorts. When a post has a post image (as this one does), I check the “Has an Image Category” so WordPress knows to display the image in the post and feed. Some, however, do use categories.
List all Categories
Unlike tags, “Category Clouds” are not as common, so here’s how you list all the categories.
List all Categories – With Link to RSS Feed
The following will list the categories and include a link to the RSS Feed as well as a category’s page.
List Some Categories
Want to exclude one or more categories. Luckily, it is not hard to do. To only include a few categories, use the following code (categories are based on ID numbers):
Alternatively, to exclude a few use this instead:
RSS Feeds
I’m sure there is some fancy way of doing this, but RSS Feeds can be done by hand. You can include a link to your main RSS feed, comments RSS feed, and category RSS Feeds (found at yoursite.com/category/feed/).
Related Links
One of the best parts of WordPress is the excellent documentation and helpful community.
Here are some related links:
Need Help?
Feel free to leave a comment! Be sure to “Subscribe to Comments” to receive notifications of followup comments.

