Manual creation of Google Sitemap in Magento

Manual creation of Google Sitemap in Magento

Most of you probably know this, but let’s define what the sitemaps are. Sitemaps are a simple way for site creators to give search engines the information about pages on their site that are available for public. Basically, those are just 1 or more XML files that lists URLs for a site along with additional meta informatio about each URL (like last update, how often it changes, its importance relevant to other pages). With this in mind, search engines can be more clever while crawling the site. Click here see how sitemap of this site looks like.

You will hear the term Google Sitemap a lot, but XML Schema for the Sitemap protocol is not related only to Google at all. It can be used in many places, but the most important is Google Webmaster Tools.

How do we create Google Sitemap in Magento?

1. Sitemap File Configuration

First we need to create sitemap file in Magento. This is basically pointer to tell Magento where to create sitemap file and how to name it. Log in to Magento Administration and go to:
Catalog -> Google Sitemap

Check to see if the sitemap file is already present. Lets assume we wish to create sitemap in the URL: http://www.yourstore.com/sitemap/sitemap.xml
To do it successfully,

  1. FTP to the server
  2. create sitemap folder
  3. chmod the folder to 777

On some servers, previous steps will not be required, but it is better to create the file first so that Magento can edit it.

Let’s go to Magento administration now and click on “Add Sitemap” button. Just insert the default values.

After this step, we just told Magento where to create sitemap file. It is not yet created.

2. Configure Sitemap

Sitemap can be configured from the interface System -> Configuration -> Catalog->Google Sitemap. If you are not sure what does it all mean, check XML Tag definitions section from “Sitemaps XML format” document.

3. Create Sitemap Manually

Looks like Magento folks were thinking that sitemap should only be created by a cron job. Yes, it can be done that way also. Be sure to read Wiki article How to Set Up a Cron Job to get familiar with it. If you are looking for manual creation, quit your search for “Create Sitemap” button. You will not find it. But there is a workaround. You can enter manual URL to execute sitemap creation:

http://www.yourstore.com/index.php/admin/sitemap/generate/sitemap_id/[ID of Sitemap from step 1]

Of course, replace the content with square brackets with actual Sitemap ID.

You made it all the way down here so you must have enjoyed this post! You may also like:

Build your 2017 Magento SEO strategy with these tips Ivona Namjesnik
Ivona Namjesnik, | 10

Build your 2017 Magento SEO strategy with these tips

Free eCommerce SEO consultations by Inchoo at Meet Magento Poland Tea Pisac Benes
Tea Pisac Benes, | 0

Free eCommerce SEO consultations by Inchoo at Meet Magento Poland

In SERP title tags no longer control what’s shown Toni Anicic
Toni Anicic, | 10

In SERP title tags no longer control what’s shown

39 comments

  1. very nice and great post was searching for this very long thanks for sharing such a useful information
    keep it up

  2. Hello and thank you for that article.
    My question is how can we make automatically various sitemaps for different type of pages, like for example a sitemap for the CMS pages, a sitemap for the products etc.? is that possible in magento or via a plugin?
    Thank you.

  3. Fatal error: Class ‘Mage__Helper_Data’ not found error come when i am going to generate site map

  4. Hi I am confused please help me through.i have created sitemap/sitemap.xml with one url priority = 1.0. But when I click generate in catalog/google sitemap its gets set to original priority. How can we change priority for home page to 1 and rest to .5 ??

  5. Does the XML sitemap generated by Magento updates automatically whenever we add new pages or products to the website? For example, in WordPress CMS, XML sitemap generated by a plugin automatically updates whenever a new page/post/category is added.

    1. or ‘chmod 775 ‘ if the webserver needs to access your files through the group permissions, like some hosting providers.. but never EVERYONE write access… rwxrwxr-x is fine!

  6. Do you know how to create different sitemaps with a different name for each one? it seems that magento only allows to name it “sitemaps” files to “sitemap.xml…. πŸ™

  7. thanks,
    for the first step where i can find the “add sitemap” button in magento backend

  8. Thanks, I kept forgetting to set permissions to 777.

    Princy: I don’t know if this got answers but the sitemap should automatically add your cms pages to the sitemap. Mine did anyways.

  9. Can i add my magento CMS pages also to my sitemap.
    Is there any way to include cms pages also through code ?

  10. Thanks for the how-to. Worked perfectly. Thanks for contributing to the Mage community. Bookmarked the site πŸ˜‰

  11. Hello,

    The Extended Sitmap extensions was released today
    http://www.magentocommerce.com/extension/1977/extended-sitemap
    It replaces the default Magento Google Sitemap functionality for auto generation of XML Site Map files with a more optimized and advanced functionality.
    Also it allows you to display all of your existing Catalog Categories, Products, CMS Pages and additional configurable links with a hierarchical structure SEO optimized for web spiders.

    Btw, thanks for the post. It really helps πŸ™‚

  12. Hi,

    I want to separate my category and product web sitemap (not google sitemap).

    http://www.mysite.com/catalog/seo_sitemap/category/
    http://www.mysite.com/catalog/seo_sitemap/product/

    The above both sitemap are created from the “/app/design/frontend/default/default/template/catalog/seo/sitemap.phtml” but I want to modify both the sitemap, so can we make two seprate files “category_sitemap.phtml and product_sitemap.phtml” so that both the sitemaps gets created from the different files. How can I do this?

    And one more thing, on product sitemap I want a product attribute as
    $_def_cat = $_item->getAttributeText(‘default_category’);

    “default_category” I have created from admin panel.

    But “default_category” attribute is not coming on this page. Can u please guide me how can i get the value of a product attribute on sitemap.

    Thanks

  13. Hi Tela,
    Yes, you can set up a cron job in the Magento administration. If you have trouble with it, you can occasionally recreate the sitemap using the steps above.

  14. Thanks so much for the tip! Exactly what I was missing.

    Now I have a question for the update of the sitemap. Do we need to manually set up a cron job like you refered to on step 3? Or is it enough to set up the cron in the admin?

  15. Thank you, the manual url was exactly what I was looking for. Now if there was a way to hide certain pages from the sitemap that would be awesome as well.

  16. Thanks for this short but useful and informative HOWTO. It’s always the small things one can overlook.

    Creating a sitemap is a must do step in order to get the Google see you’re site clearer and faster.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.