How to upload sitemap.xml to google app engine

Ah the world wide web… the old www. So many factors to consider when developing web applications, especially if you’re used to developing in a relatively simple research environment.

One thing you will think about is how to get Google to include your page in it’s searchers (i.e., get indexed). To do this, we’ll submit a sitemap to Google. Basically a sitemap lists the links that you want Google to start indexing (so other people can find it when they search the web).

If you’re using WordPress, this is pretty simple, and you can just download a plugin and skip to the last step below (step 6).

However, if you’re using Google App Engine to run your site, then you need to do a few more steps. So here’s instructions for how to do this.

How to submit a sitemap.xml using Google app engine

  1. Create a sitemap and download it as sitemap.xml
  2. I used this (my first google hit), which seemed to work pretty well.

  3. Put sitemap.xml in your main folder of your app
  4. For this example, we’ll put sitemap.xml right in the main folder of your google app engine project (i.e., same directory where the app.yaml file is).

  5. Change app.yaml to include sitemap.xml
  6. Add these three lines to app.yaml:

    - url: /sitemap.xml
    static_files: sitemap.xml
    upload: sitemap.xml

    Make sure that these three new lines are above the url: .* part of the code. So your app.yaml should contain lines that look something like this:

    - url: /sitemap.xml
    static_files: sitemap.xml
    upload: sitemap.xml
    - url: .*

    Note that the order really matters here. If you have the url: .* above the url: /sitemap.xml, this will not work! I was stuck on this for about an hour until I came across this link.

  7. Run your dev app server and check if can view the sitemap
  8. Run your dev app server to get your google app running:
    (on linux)
    $ .

    Then open your browser and check to make sure you can see the sitemap here (assuming you’re using the default port):

    If so, yay! We are almost done.

  9. Push to production
  10. (on linux, change the parameters below to match your project)
    $ gcloud app deploy --project my_app_name -v v1

  11. Submit sitemap.xml to Google

    You need to go through Google’s webmaster tools to authenticate your site as your own, so follow the steps here:

    Once you have added your site, just add the sitemap.

    Navigation bar on the left:
    Crawl -> Sitemaps

    Then click the Add/Test Sitemaps button on the right and add sitemap.xml to the box the comes up. Test and submit and you are good to go!

And that’s it! You should have a successfully submitted sitemap.xml to Google now.