Jump to content

Guide to Sitemaps


Recommended Posts

Sitemaps help search engines index pages of your site. It’s a very nice addition to any SEO practice! Every sitemap has the same structure to it, and I’d suggest including both pages and images. 

Sitemap Set-Up

Create an empty XML file (most people call it sitemap.xml) and insert the following.

Top Wrapper

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

Bottom Wrapper


Every page will then have it’s own code within those tags.

Example page:


The only required item required for each page is loc, which is the URL of the page you want your search engine to find. 

changefreq is how often the page should be re-crawled for new content. The options for this are:

  • always
  • hourly
  • daily
  • weekly
  • monthly
  • yearly
  • never

lastmod is when the page was last changed, sort of similar to changefreq in how a search engine will use it. If you are using changefreq, you probably don’t need to use this. It may be nice to put on your news overview page though and update it whenever there's a new post!

priority is how important a page is compared to others, on a scale of 0.0 to 1.0. When a search engine is showing results and it gets to your site, it may use the priorty to choose which page to show. Homepage and registration should probably be set at 1, with other pages set less than that. The priorty is relative, so setting everything to 1 is the same as setting everything to 0.

A completed sitemap might look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">


Want your images to show up in searches too? You can add images to a sitemap in the same way! You can either have these in the same sitemap, or create a separate one. You can submit more than one sitemap to search engines.


PHP Sitemap

If you have a lot of pages, or a lot of images, it be nice to automate your sitemap. Instead of an XML page, create a PHP page with an XML header.

Below is an example of a PHP image sitemap, that’s grabbing all images from a imgs/dogs folder.

<?php header('Content-type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$imgs = scandir('imgs/dogs');
foreach ($imgs as $img) {
    if (strlen($img) > 4) {
        echo '<url>
echo '</urlset>'; ?>


Search Engines


After you have your sitemap made, add it to your robots.txt file with the following line.

Sitemap: https://ohudogs.com/sitemap.xml

Google Search Console (aka Webmaster Tools)

To submit your sitemap to Google, login to your Google Search Console account, select your site, and then go to Crawl --> Sitemaps. In the upper right hand corner, you should see a Add/Test Sitemap button


Bing Webmaster Tools

Hey it’s a free tool, might as well get those people using Bing too! Login, click on your site, and scroll down to Sitemaps, and click the “Submit a Sitemap” button.



View full guide

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...