Add image caption and title to sitemap.xml

Sitemap.xml allows a search engine robot (Google, Bing, Baidu, Duckduckgo and others) to simplify work, so it will be easier for search engine to find new information and index it. But don’t add excessive and non-existent information, because it will not be accepted anyway.

Pages in sitemap.xml are listed like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
            xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<url>
  <loc>https://ultra-technology.org/freebsd/freebsd-minimal-xorg-installation/</loc>
  <lastmod>2019-06-12</lastmod>
</url>
<url>
  <loc>https://ultra-technology.org/freebsd/chinese-japanese-korean-input-freebsd/</loc>
  <lastmod>2019-05-21</lastmod>
</url>
...

That is, links to articles are listed.

But what if these pages contain images? There are special robots, like Google Images Bot, Duckduckgo Images Bot and others. These robots are engaged in image indexing (These are images that we can find in a search engine by clicking ‘Images’).

And we want images to be indexed in a few hours? Sitemap.xml has special tags for images that image robots use.

Make sure, that in your sitemap.xml image namespace is defined:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
            xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">

The first tag is <image:image></image:image>. This is where an image description begins and ends. This can be inserted between <url></url> tags after the page description ends, like this:

<url>
  <loc>https://ultra-technology.org/freebsd/freebsd-minimal-xorg-installation/</loc>
  <lastmod>2019-06-12</lastmod>
  <image:image>
  </image:image>
</url>

The second tag is <image:loc></image:loc>, loc literally means ‘location’, where an image is located. Insert image URL address between these tags, like this:

<url>
  <loc>https://ultra-technology.org/freebsd/freebsd-minimal-xorg-installation/</loc>
  <lastmod>2019-06-12</lastmod>
  <image:image>
      <image:loc>https://ultra-technology.org/wp-content/uploads/2019/05/FreeBSD-dwm-build-configuration.jpg</image:loc>
</image:image>
</url>

This may already be enough. A search engine robot already able to find the image and define its subject. This image will quickly appear in search results.

There are two additional tags – <image:caption></image:caption> and <image:title></image:title>. As their name implies, this is the caption and title of an image.

It can also be inserted between <image:image></image:image> tags, as is the case with <image:loc></image:loc>, like this:

<url>
  <loc>https://ultra-technology.org/freebsd/freebsd-minimal-xorg-installation/</loc>
  <lastmod>2019-05-19</lastmod>
  <image:image>
            <image:loc>https://ultra-technology.org/wp-content/uploads/2019/05/FreeBSD-dwm-build-configuration.jpg</image:loc>
            <image:caption>Uncheck DMENUANDSTERM because we already have installed these utilities</image:caption>
             <image:title>dwm build configuration menu</image:title>
   </image:image>
</url>

If an article has several images, use all of the things above for each image:

<url>
  <loc>https://ultra-technology.org/freebsd/freebsd-minimal-xorg-installation/</loc>
  <lastmod>2019-05-19</lastmod>
  <image:image>
           <image:loc>https://ultra-technology.org/wp-content/uploads/2019/05/FreeBSD-dwm-build-configuration.jpg</image:loc>
           <image:caption>Uncheck DMENUANDSTERM because we already have installed these utilities</image:caption>
           <image:title>dwm build configuration menu</image:title>
   </image:image>
   <image:image>
           <image:loc>https://ultra-technology.org/wp-content/uploads/2019/05/FreeBSD-neofetch-under-X-with-dwm.png</image:loc>
           <image:caption>Neofetch in sterm with dwm. In total, I got 72 packages in the system. This is really a very small amount</image:caption>
           <image:title>Neofetch in FreeBSD with dwm installed</image:title>
   </image:image>
   <image:image>
           <image:loc>https://ultra-technology.org/wp-content/uploads/2019/05/FreeBSD-firefox-with-dwm.png</image:loc>
           <image:caption>Firefox with minimal Xorg installation with 1 font package installed</image:caption>
           <image:title>Firefox in FreeBSD with minimal xorg installation</image:title>
   </image:image>
</url>
Updated: June 13, 2019 — 9:11 am