Jump to content

Sitemaps

From Wikiversity

A sitemap is a good way to help searchbots index your website, and increase your search-engine rankings.

plaintext sitemaps

[edit | edit source]

The easiest way to create a sitemap (for a small website) is to simply list out each webpage on your site in a plaintext file, with one URL per line, saved as "sitemap.txt" in your website's root directory.

example plaintext sitemap

[edit | edit source]

The plaintext below, if saved in UTF-8 as "sitemap.txt" and placed in the root directory at "https://en.wikiversity.org/sitemap.txt," would help searchbots to index those links and pages for their search engines.

https://en.wikiversity.org/
https://en.wikiversity.org/w/
https://en.wikiversity.org/wiki/
https://en.wikiversity.org/wiki/Main_Page
https://en.wikiversity.org/wiki/sitemap
https://en.wikiversity.org/wiki/Sitemaps

notes

[edit | edit source]
  • Always place your sitemap in the website's root directory if possible.
  • Always save a sitemap as UTF-8.
  • Do not list more than one URL per line.
  • Do not add any additional text or comments.
  • Do not list more than one host or subdomain, e.g. URLs for "https://www.wikiversity.org/" or "https://de.wikiversity.org/" should not be listed on the sitemap for "https://en.wikiversity.org/." Each host or subdomain will need its own sitemap.
  • Do not list URLs using more than one protocol. All of the URLs listed should be either just HTTP or just HTTPS.
  • Do not list more than 50,000 URLs.
  • The total size of the text file must be less than 50 megabytes.

XML sitemaps

[edit | edit source]

Sitemaps can also be encoded in XML, and saved as "sitemap.xml" in the root directory.

example XML sitemap

[edit | edit source]
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>http://www.example.net/?id=who</loc>
    <lastmod>2009-09-22</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>http://www.example.net/?id=what</loc>
    <lastmod>2009-09-22</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
  </url>
  <url>
    <loc>http://www.example.net/?id=how</loc>
    <lastmod>2009-09-22</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
  </url>
</urlset>
[edit | edit source]