DEV Community

Cover image for Page-specific options
Top
Top

Posted on

Page-specific options

When generating the XML sitemap, you may have noticed a couple additional fields being shown:

<url>
  <loc>https://www.your-website.com/page-1</loc>
  <changefreq>daily</changefreq>
  <priority>0.5</priority>
</url>
<url>
  <loc>https://www.your-website.com/page-2</loc>
  <changefreq>daily</changefreq>
  <priority>0.5</priority>
</url>
Enter fullscreen mode Exit fullscreen mode

In fact, there are a handful of options that can be used to tweak each page, for optimal effects.

changefreq

changefreq is a measure of how often your page changes. From the Sitemaps protocol:

This value provides general information to search engines and may not correlate exactly to how often they crawl the page. Valid values are:
always
hourly
daily
weekly
monthly
yearly
never
The value "always" should be used to describe documents that change each time they are accessed. The value "never" should be used to describe archived URLs.

For a blog, I feel like daily fits most usecases pretty well

priority
priority is a relative measure of a page's importance. You can use this to signal to the crawler which pages it should care about, and which aren't so important. There are 11 values available to you: 0.0 through 1.0.

If you're a clever trickster, you might be concocting a devious plan: set every page to a `1.0` priority, and watch as your site rockets to the top of the search results!

Unfortunately, this scheme doesn't work—`priority` is a _**relative**_ measure of importance. It won't affect how your site compares to other sites.
Enter fullscreen mode Exit fullscreen mode

lastmod
Finally, we can add a date-time stamp to indicate when the page was last modified.

I'm honestly not sure how valuable this is, since presumably Googlebot is smart enough to detect when a page's content has changed, but correctly following a specification can't hurt!

Down the rabbit hole
If you're interested in learning about what other options are available, or if you're stuck trying to debug a problem, I thought I'd share some of the digging I did when researching for this tutorial.
gatsby-plugin-sitemap defers to an NPM package, sitemap. At the time of writing, it relies on an outdated version of this package, version 1.13.
Hopefully, this isn't something you need to dig into. If needed, though, you can learn more on the version 1.13 docs of the sitemap package.

Discussion (0)