Download the PHP package groe/craft-sitemap without Composer
On this page you can find all versions of the php package groe/craft-sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download groe/craft-sitemap
More information about groe/craft-sitemap
Files in groe/craft-sitemap
Package craft-sitemap
Short Description Craft plugin to generate a sitemap.
License MPL 2.0
Informations about the package craft-sitemap
NOTE: This is a fork of the currently unmaintained craft-sitemap plugin by @joshuabaker. The original author has not responded to questions regarding his plans for the future of the project. So feel free to use the fork while we (hopefully) merge it back some day.
Craft Sitemap
A simple plugin for Craft that generates a sitemap.xml based on enabled sections.
Installation
- Copy the
sitemap/
folder intocraft/plugins/
- Go to Settings → Plugins and click the “Install” button next to “Sitemap”
Usage
Within the plugin settings, check the boxes in the “Enabled” column to include them in the sitemap.
To view the output visit /sitemap.xml
.
Advanced
This plugin exposes various ‘Hooks and Events’ documentation, if you’re not sure how this works.
Hooks
renderSitemap
Add a renderSitemap
method to your plugin to add items via the various service methods listed below.
Here’s an example plugin hook method with comments:
And here’s an example of the resulting element in the sitemap XML:
Service Methods
There’s several service methods made available to add items to the sitemap.
addUrl($loc, $lastmod, [$changefreq, [$priority]])
Adds a URL to the sitemap.
addElement(BaseElementModel $element, [$changefreq, [$priority, [$currentLocaleOnly, [$alternateUrls]]]])
Adds an element to the sitemap.
addSection(SectionModel $section, [$changefreq, [$priority, [$currentLocaleOnly, [$alternateUrls]]]])
Adds all entries in the section to the sitemap.
addCategoryGroup(CategoryGroupModel $categoryGroup, [$changefreq, [$priority, [$currentLocaleOnly, [$alternateUrls]]]])
Adds all categories in the group to the sitemap.
getElementUrlForLocale(BaseElementModel $element, $locale)
Gets a element URL for the specified locale. The locale must be enabled.
getUrlForLocale($path, $locale)
Gets a URL for the specified locale. The locale must be enabled.
Helper Classes
Sitemap_ChangeFrequency
Enumeration of valid changefreq
values.