Jump to content
Sign in to follow this  
Regnant

Guide to Sitemaps

Recommended Posts

Quill
LV 3

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

</urlset>

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

Example page:

<url>
	<loc>https://ohudogs.com/</loc>
	<changefreq>monthly</changefreq>
	<lastmod>2017-04-12</lastmod>
	<priority>1</priority>
</url>

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">
	<url>
		<loc>https://ohudogs.com/</loc>
		<changefreq>monthly</changefreq>
		<priority>1</priority>
	</url>
	<url>
		<loc>https://ohudogs.com/about/</loc>
		<priority>0.5</priority>
	</url>
  	<url>
		<loc>https://ohudogs.com/register/</loc>
		<priority>0.8</priority>
	</url>
</urlset>

Images

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.

<url>
	<loc>https://ohudogs.com/imgs/dogs/gin.png</loc>
</url>

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>
          <loc>https://ohudogs.com/imgs/dogs/'.$img.'</loc>
        </url>';
    }
}
echo '</urlset>'; ?>

 

Search Engines

robots.txt

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

58ee2fc366a55_SearchConsoleSitemapshttpohudogs_com.thumb.png.cc338058a703e15b39ca0bcfb7a7ffd6.png

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.

58ee2fc557f4a_DashboardBingWebmasterTools(1).thumb.png.8d8749aa6e55535f867fcd41c1173fe9.png

 


View full guide

Share this post


Link to post
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.

Guest
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.

Sign in to follow this  



×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Terms of Use, and Privacy Policy.