Moodle Plugins directory: Public sitemap | Moodle.org
Public sitemap
local_kopere_sitemap is a Moodle plugin that automatically generates a public XML sitemap for the site and adds a reference to the sitemap in the <head> of all Moodle pages.
The plugin’s purpose is to make it easier for search engines to index your Moodle site (Google, Yahoo, DuckDuckGo, etc.), allowing crawlers to find relevant public pages on the platform, such as open courses, categories, forums, and homepage content.
The sitemap is generated dynamically from the existing data in the Moodle database and respects content visibility settings.
The plugin has two main components:
- XML Sitemap Generator
- Automatic injection of the sitemap link into the site’s
<head>
These two mechanisms work together to allow search engines to discover and index the platform’s public content.
The sitemap is available at the following URL:
This page generates a valid XML file following the Sitemap protocol standard:
Simplified example of the generated XML:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://yourmoodle.com</loc>
<lastmod>2026-03-09T10:30:00+00:00</lastmod>
</url>
<url>
<loc>https://yourmoodle.com/course/view.php?id=5</loc>
<lastmod>2026-03-08T19:10:00+00:00</lastmod>
</url>
</urlset>
Each item contains:
- loc → public URL
- lastmod → last modification date
The administrator can choose which types of content should be included in the sitemap.
Includes the Moodle homepage:
This is usually the first page indexed by search engines.
Includes visible categories in the course tree.
Example:
Only categories marked as visible are included.
Courses are included when they meet the following conditions:
- course is visible
- category is visible
- has an active enrollment method
- usually with self-enrollment
Example URL:
This allows public courses to be found by search engines.
If enabled, the sitemap includes public entries from the Moodle blog.
Example:
Only posts published with public visibility are listed.
Visible forums may appear in the sitemap when:
- they are on the front page
- or they belong to courses accessible to guests
Example:
Activities added to the front page course (course id = 1) may also appear in the sitemap.
Example:
https://yourmoodle.com/mod/page/view.php?id=12
https://yourmoodle.com/mod/url/view.php?id=8
https://yourmoodle.com/mod/resource/view.php?id=3
Only visible modules are included.
The plugin uses Moodle’s modern Hooks system to automatically insert the sitemap link into the <head> of pages.
Example of generated HTML:
<link rel="sitemap" type="application/xml" title="Sitemap" href="https://yourmoodle.com/local/kopere_sitemap/sitemap.php">
This link allows:
- search engines to discover the sitemap automatically
- crawlers to interpret the site structure
- SEO tools to detect the LMS sitemap
The administrator can configure the plugin’s behavior through the administrative settings.
Allows the sitemap generation to be completely enabled or disabled.
When disabled:
- the sitemap is not generated
- the link in the
<head>is not inserted
Allows you to define the public URL of the sitemap.
Normally:
It is also possible to define an absolute URL.
Includes the Moodle homepage in the sitemap.
Includes public and visible courses that allow enrollment.
Includes visible course categories.
Includes public posts from the Moodle blog.
Includes visible forums from accessible courses.
Includes activities from the front page course.
The plugin was designed to work with search engines and SEO tools.
The sitemap follows:
- the official sitemap protocol standard
- valid XML format
- absolute URLs
- dates in ISO-8601 format
This ensures compatibility with:
- Google Search Console
- Yahoo Webmaster Tools
- SEO crawlers
- automatic indexers
Comments