Sitemap Users — XML Sitemap for User Profiles
A plugin for Cotonti. Generates an XML sitemap exclusively for user profiles. Helps search engines find and index public user pages.
- Category Extentions
- SEO and optimization
Sitemap Users — XML Sitemap for User Profiles
A plugin for Cotonti. Generates an XML sitemap exclusively for user profiles.
Helps search engines find and index public user pages.
History and Why It Is Needed
This plugin is part of a project to split the standard SiteMap plugin (included with Cotonti) into several independent plugins.
The original SiteMap generated one large sitemap for the entire site: pages, forums, users, products.
Any changes or errors in one section required fixing the entire plugin, which often broke the whole map.
To avoid this problem, it was decided to break the single plugin into specialised ones, each responsible only for its own content type:
- sitemap_users – XML sitemap for user profiles (this plugin)
- sitemap_pages – XML sitemap for pages (with multilingual support)
- sitemap_forums – XML sitemap for forums
- sitemap_market – XML sitemap for products (Market module)
Each plugin is fully autonomous, configured separately, and does not affect the operation of others.
This approach simplifies maintenance and allows flexible management of the site’s sitemaps.
sitemap_users was created based on the original SiteMap code but was completely reworked specifically for the users module and adapted for PHP 8.x.
Features
- Generates an XML sitemap containing links to the profiles of all publicly viewable users (respecting access rights).
- Automatically splits the sitemap into multiple files (sitemap index) if the total number of links exceeds the specified limit (
perpage). - Upon installation, automatically adds links to the sitemap in
robots.txt. - Upon installation, automatically adds rewrite rules to
.htaccessfor pretty URLs (if the URLEditor plugin is active). - Caches generated sitemaps into files for fast delivery.
- Flexible settings: update frequency, priority for user profiles.
- Full compatibility with PHP 8.x.
Requirements
- Cotonti Siena (the latest version is recommended)
- The
usersmodule — must be installed and active - The
urleditorplugin — if you plan to use pretty URLs (sitemap-users.xml) - Write permissions for the
datas/cache/folder (for caching sitemaps) - Access to the user list: to generate the sitemap the plugin checks the
cot_auth('users', 'a', 'R')permission. Ensure that guests or search bots have this right (by default in Cotonti guests cannot view the user list). It is recommended to enable this right in the admin panel: Rights → users → a (user list) → Guests: read. - PHP 8.0 or higher
Plugin Structure
sitemap_users/
├── sitemap_users.setup.php # Plugin header, metadata and settings
├── sitemap_users.ajax.php # Main request handler (AJAX)
├── inc/
│ └── sitemap_users.functions.php # Functions: XML compression, date handling, saving sitemaps
├── lang/
│ ├── sitemap_users.ru.lang.php # Russian labels for settings
│ └── sitemap_users.en.lang.php # English labels for settings
├── tpl/
│ ├── sitemap_users.tpl # Template for a standard urlset
│ └── sitemap_users.index.tpl # Template for a sitemap index file (sitemapindex)
└── setup/
└── sitemap_users.install.php # Automatically adds links to robots.txt
# and rules to .htaccess during installation
Installation
- Download the ZIP archive of the plugin from the GitHub repository.
- Extract the archive into the
plugins/folder of your site. You should get the structure described above. - Go to the Cotonti admin panel → Extensions.
- Find the «Users Sitemap» plugin in the list and click «Install».
Important: during installation the plugin automatically:
- Adds links to the user sitemap in
robots.txt.- Adds rewrite rules to
.htaccessfor pretty URLs (only if URLEditor is active and these rules do not already exist).
After installation, the plugin starts working immediately. Don't forget to check the access rights to the user list (see Requirements).
Plugin Settings in the Admin Panel
All settings are located in Extensions → Users Sitemap → Configuration.
| Parameter | Type | Default | Description |
|---|---|---|---|
cache_ttl | string | 3600 | Cache lifetime in seconds. |
perpage | string | 50000 | Maximum number of URLs in one sitemap file. |
freq | select | default | Default change frequency. |
prio | select | 0.5 | Default priority. |
users | radio | 1 (on) | Include user profiles in the sitemap. |
users_freq | select | daily | Change frequency of profile pages. |
users_prio | select | 0.5 | Priority of profile pages. |
use_pretty_urls | radio | 1 (on) | Use pretty URLs for the sitemap. |
It is recommended to keep the default values unless you have specific requirements.
Setting Up Pretty URLs (SEF)
To make your sitemap available at:
https://yoursite/sitemap-users.xml– main sitemaphttps://yoursite/sitemap-users-index.xml– sitemap index (for a large number of URLs)
the URLEditor plugin must be active with any preset other than none.
During installation, the plugin itself adds the following rules to .htaccess (if they are not already there):
RewriteRule ^sitemap-users\.xml$ index.php?r=sitemap_users [L]
RewriteRule ^sitemap-users-index\.xml$ index.php?r=sitemap_users&a=index [L]
You do not need to write these rules manually — the installation does everything automatically. If you have disabled automatic modification of .htaccess, simply copy the lines above into your .htaccess after the RewriteEngine On line.
Usage
Viewing the Sitemap
- Main sitemap: open in your browser
https://yoursite/sitemap-users.xmlorhttps://yoursite/index.php?r=sitemap_users - Sitemap index (if the sitemap is split into parts):
https://yoursite/sitemap-users-index.xmlorhttps://yoursite/index.php?r=sitemap_users&a=index
Adding to robots.txt
During installation, the plugin automatically adds the following lines to the root robots.txt (depending on the SEF settings):
Sitemap: https://yoursite/index.php?r=sitemap_users
Sitemap: https://yoursite/index.php?r=sitemap_users&a=index
Sitemap: https://yoursite/sitemap-users.xml
Sitemap: https://yoursite/sitemap-users-index.xml
If you need to modify or remove these links, edit robots.txt manually.
Validating the Sitemap
You can use the XML Sitemap Validator or similar services to verify that the sitemap is generated correctly.
Caching and Clearing the Cache
Generated sitemaps are stored in the datas/cache/sitemap_users/ folder and are only regenerated after the cache_ttl time has expired (1 hour by default). This significantly reduces server load during frequent requests from search engines.
If you need to force an update before the cache expires, simply delete the files in the cache folder (datas/cache/sitemap_users/). They will be recreated on the next request.
Detailed Description of Each File
Below is a very detailed description of every file included in the plugin. The description goes from general purpose to specific details so that a beginner can understand.
1. sitemap_users.setup.php
Purpose: the "passport" of the plugin. It stores information that Cotonti uses to register the plugin in the system and to build the settings page in the admin panel.
What it contains:
- The
[BEGIN_COT_EXT]/[END_COT_EXT]section – plugin metadata: its code, name, category, description, version, author, required modules, access rights. - The
[BEGIN_COT_EXT_CONFIG]/[END_COT_EXT_CONFIG]section – a list of settings available to the administrator. Format:parameter_name=order:type:default_value:hint. Examples:cache_ttl,freq,users.
Important: manually editing this file is not recommended — all settings can be changed through the admin panel and they are saved in the database.
2. sitemap_users.ajax.php
Purpose: the heart of the plugin. It is called via an AJAX hook when someone opens the sitemap link. It generates and serves the ready XML sitemap.
How it works (step by step):
- Output protection: clears buffers, sets the
Content-Type: application/xml; charset=utf-8header. - Getting parameters:
$d(part number) and$a(action:'index'for the sitemap index). - Reading plugin settings.
- Determining cache paths (folder
datas/cache/sitemap_users/). - Generating the sitemap index file (for
?a=index): checks the cache, recalculates parts, builds<sitemapindex>. - Generating the main sitemap: if the cache is stale, rebuilds the data: checks access to the user list, selects users, builds URLs, passes them to the template, saves parts to the cache.
- Serving the ready file: determines the required cache file, reads, cleans and outputs it with the correct XML declaration.
3. inc/sitemap_users.functions.php
Purpose: a library of helper functions.
sitemap_users_compress— removes unnecessary whitespace characters from XML.sitemap_users_date— formats a Unix timestamp into W3C (ISO 8601).sitemap_users_freq— returns the value for<changefreq>(if notdefault).sitemap_users_prio— similarly for<priority>.sitemap_users_parse— adds one entry to the template, saves the current part when the limit is reached.sitemap_users_save— saves the XML into a cache file.
4. Language Files (lang/sitemap_users.ru.lang.php and en.lang.php)
Purpose: translation of strings shown in the admin panel when editing plugin settings. They contain the $L array and arrays for dropdown lists.
5. Templates (tpl/)
sitemap_users.tpl (standard sitemap)
Contains the <!-- BEGIN: MAIN --> block with the root element <urlset> and the <!-- BEGIN: SITEMAP_ROW --> block for a single URL. Conditional blocks {SITEMAP_ROW_DATE}, {SITEMAP_ROW_FREQ}, {SITEMAP_ROW_PRIO} allow optional tags to be omitted.
sitemap_users.index.tpl (sitemap index)
Similar, but the root element is <sitemapindex>, and inside the SITEMAP_ROW block there is <sitemap> with <loc> and optionally <lastmod>.
Important: never add the line <?xml version="1.0" encoding="UTF-8"?> to these templates — it is inserted programmatically.
6. setup/sitemap_users.install.php
Purpose: runs when the plugin is installed. It configures robots.txt (adds links to the sitemap) and .htaccess (adds rewrite rules for pretty URLs), if they are writable and the rules do not already exist.
Usage Example
- Install the plugin (see Installation).
- In the Cotonti admin panel, enable the right for guests to read the user list (Rights → users → a → Guests: read).
- Check that the
Sitemap:lines have appeared inrobots.txt. - Open
https://yoursite/sitemap-users.xml— you will see XML with a list of user profiles. - To validate the sitemap with an online validator, add
'Sitemaps Generator'to the bot whitelist of thevisitor_statsplugin if it is installed.
Troubleshooting
- The sitemap does not open (404 or 500 error). Check that the
usersmodule is active and that thedatas/cache/sitemap_users/folder is writable. - The sitemap is empty, although there are users. Check the access rights: guests must be allowed to read the user list (Rights → users → a → Guests: read).
- Pretty URLs (
sitemap-users.xml) are not working. Make sure theurleditorplugin is active, its preset is notnone, and the rules have been added to.htaccess. - The validator shows an «Incorrect http header content-type: text/html» error. Add
'Sitemaps Generator'to the bot whitelist ofvisitor_stats(fileWhitelistBots.php). - The sitemap index is empty or contains incorrect links. Clear the cache and check the
perpageanduse_pretty_urlssettings.
License
Distributed under the BSD license. Free use and modification as long as the copyright notice is preserved.
Links
- Plugin Repository
- Support Forum
- Source Code of the Original SiteMap (included with Cotonti)
- URLEditor Plugin (required for pretty URLs)
Offline
webitproff
Last logged: 2026-09-19 10:26
- Publication date 2026-08-05 10:47
- Updated 2026-09-13 14:17
Page Discussion in Telegram
Последние сообщения
- i18n modified - Модифицированный плагин мультиязычности
webitproff, 2026-09-19 07:55i18n modified - Модифицированный плагин мультиязычности
- Пропали ссылки на плагины в шаблонах
webitproff, 2026-09-19 06:07еще по теме, если есть ложное срабатывание при проверке активности плагина, - читать статью “Баг в ядре Cotonti при проверки активности плагина с всего одним хуком”
- Market PRO + всё, что связано с ЧПУ
webitproff, 2026-09-13 01:11частиный functions.custom.php <?php /** * Файл: system/functions.custom.php * * Читать инструкцию https://github.com/webitproff/functions.custom.php-cotonti/blob/main/README.md * * Пользоват...
- Market PRO + всё, что связано с ЧПУ
webitproff, 2026-09-13 01:09пресет правил/plugins/urleditor/presets/marketplace.datforums m=posts&q=&d= forums/{forums_url_structure()}/page{$d} forums m=posts&q=* forums/{forums_url_structure()} forums ...
- Tab "вкладка товаров" на странице профиля пользователя
webitproff, 2026-09-13 00:43Подробное описание файла market.userdetails.php1. Общая информация Параметр Значение Имя файла market.userdetails.php Расположение modules/market/market.userdetails.php Хук Cotonti users.details.ta...
- Multicat Market - Плагин для CMF Cotonti
webitproff, 2026-09-11 23:11Multicat MarketПлагин для модуля Market v5+ CMF Cotonti, позволяющий назначать одному товару (странице модуля Market) сразу несколько категорий структуры market. Вся реализация выполнена через стандар...
- Market PRO — модуль интернет-магазина и торговой площадки для Cotonti
webitproff, 2026-09-10 13:44Market PRO — модуль интернет-магазина и торговой площадки для CotontiГотовое решение для создания как классического интернет-магазина с одним продавцом, так и полноценной торговой площадки (маркетплей...
- Полное руководство по функции cot_market_enum()
webitproff, 2026-09-10 02:56Полное руководство по функции cot_market_enum()Функция cot_market_enum() — это мощный генератор списков товаров для модуля Market в Cotonti. Она позволяет вывести товары в любом месте сайта: на главно...
- В формах добавления и редактирования пропали картинки
webitproff, 2026-09-09 17:21Решил я “допекти” модуль товаров под котонти верону основательно. в процессе доработок тестирую, по привычке по ссылке гружу картинку к товару и какой-то там эрор без смысловой нагрузки и картинки нет...
- Инструкция: вывод в шаблон имени и ссылки на профиль пользователя в Cotonti
webitproff, 2026-09-07 15:15Инструкция: вывод имени и ссылки на профиль пользователя в CotontiВ этой инструкции описано, как получить данные о пользователе (текущем или владельце любой сущности) и передать их в шаблон в виде трё...
Market PRO Showcase
CMS, Script and Engine - website of an online showcase, online store of digital products and digital goods. Different prices in different currencies for the product. Online cryptocurrency payment for goods and services.