# Creating a Google Sitemap for your APEX Application

This is an update to a post I made at [https://www.insum.ca/search-engine-optimization-with-apex-creating-a-google-sitemap/](https://www.insum.ca/search-engine-optimization-with-apex-creating-a-google-sitemap/)

The content of that blog post remains relevant, so I won't repeat it all here. I will simply recap a few updates specifically for APEX friendly URLs.

## **Why register a Google Sitemap?**

Google’s default crawling algorithm is likely to miss a lot of content within an APEX application. The APEX URL format consists of the pattern something like this: https://\[host\]/\[ords\_mapping\]/r/shema-alias/application-alias/app-page-alias?p10\_id=1234

While this is better than it was prior to friendly URLs, that parameter at the end causes Google (and others) to not crawl the link. The solution is to give Google a sitemap with all of the pages you want Google to crawl.

## **Create a Sitemap in the Google Format**

Following the instructions in [my original blog post](https://www.insum.ca/search-engine-optimization-with-apex-creating-a-google-sitemap/), along with the changes below, will give you a functional Google sitemap. To fully understand Google sitemaps, and get started on Search Engine Optimization, you should start at the link below.  
[**https://support.google.com/webmasters/answer/183668?hl=en**](https://support.google.com/webmasters/answer/183668?hl=en)

## Two updates

While following the original blog post, you will make two changes.

### New Package

The new package is located here:  
[https://github.com/ainielse/google-sitemap](https://github.com/ainielse/google-sitemap)

### Change to Resource Handler

The only other change is in the definition of the ORST REST Service resource handler.

```xml
begin
  --set the Content-Type header
  owa_util.mime_header ('application/xml', true);
  my_sitemap.page_xml(p_app_id => :MY_APP_ID);
end;
```

Adding `owa_util.mime_header ('application/xml', true);` sets the correct mime type.

That does it.
