Описание
Lightweight Sitemap Generator is a minimal yet powerful WordPress plugin that creates a valid XML sitemap for search engines (Google, Yandex and others), fully compliant with sitemaps.org.
Main features:
- Generates a valid
sitemap.xmlwith proper<loc>and<lastmod>tags (ISO-8601 UTC format) - Unified structure for posts, pages, products, and taxonomies
- Global chronological order (newer older)
- Automatic duplicate prevention across all sources
- Two modes:
- File mode — creates a static sitemap in the site root (minimal server load)
- Dynamic mode — builds sitemap on-the-fly (always up to date, cached with TTL)
- Clean and minimal settings page in WP Admin:
- Enable or disable posts, pages, categories, tags, authors, archives
- Supports WooCommerce products, DW Q&A, and all detected custom post types/taxonomies
- Homepage is always included automatically
- Flexible
<lastmod>for homepage:- Smart — based on the most recently updated content
- Conservative — static front-page date
- Fast — current time on each generation
- Optional sitemap splitting (up to 50 000 URLs per part) with automatic sitemap index
- Two independent generation engines — optimized for both regular and ultra-large sites
- Detects potential conflicts with other sitemap providers and SEO plugins
- Shows last generation time (UTC or site timezone)
- Safe caching with TTL and diagnostic comments (HIT / MISS / timing)
- HTTP header support:
- Sends correct Content-Type, Last-Modified, Cache-Control, and ETag headers
- Optional X-Robots-Tag: noindex, follow header for sitemap requests
- Security and reliability:
- Capability checks and nonce validation
- Strict sanitization and option whitelisting
- File operations via
WP_Filesystem(with safe fallback) - No external requests — lightweight and self-contained
Credits
Created by Andrey Berestov
Скриншоты
Установка
- Upload the plugin folder to
/wp-content/plugins/or install via Plugins Add New. - Activate the plugin in the WordPress admin.
- A new menu item Lightweight Sitemap will appear in the admin sidebar. Open it, configure the options you need, and click Generate / Update sitemap.
- Your sitemap will be available at:
https://example.com/sitemap.xml
Часто задаваемые вопросы
-
I see a conflict warning with another SEO plugin. Should I worry?
-
No. The conflict check is purely informational. It just means that another plugin is also generating an XML sitemap.
In most cases you can simply disable sitemap generation in that plugin (Yoast SEO, Rank Math, SEOPress, etc.).
This does not affect your site’s performance or indexing; it’s just to help avoid confusion. -
Why doesn’t the plugin split the sitemap into multiple files by category (like the default WordPress sitemap)?
-
The native WordPress sitemap (
/wp-sitemap.xml) generates multiple files for posts, pages, categories, tags, and other objects.
This structure is not wrong, but it makes things more complex without real SEO benefit.According to the official sitemaps.org specification and search engine documentation (Google, Yandex, Bing), there is no ranking or indexing advantage in splitting by taxonomy.
Search engines only care that:
— All important URLs are listed.
— Each URL has a correct<loc>and (optionally)<lastmod>.
— The sitemap is valid XML and under the 50,000 URL / 50 MB per file limit.The plugin keeps one clean sitemap (with automatic split into parts only when necessary). This avoids clutter, reduces confusion for users, and keeps things minimal yet powerful.
-
These optional fields (
<priority>and<changefreq>) were part of the early sitemap protocol but are ignored by all major search engines today.
— Google officially states that these values are not used for crawling or ranking decisions.
— Yandex also ignores them and relies only on<loc>and<lastmod>.Including these tags gives a false sense of control without actual effect. That’s why the plugin follows the modern standard: only
<loc>and<lastmod>are included, which is exactly what search engines expect and trust. -
Why doesn’t the plugin include images or videos in the sitemap?
-
This is intentional. Modern search engines such as Google and Yandex are fully capable of discovering images and videos directly from your pages.
Including media entries in the sitemap may significantly increase file size and slow down generation on large sites, without providing real SEO benefits for most users.The plugin focuses on reliability, performance, and standards compliance — keeping the sitemap lightweight, fast to generate, and easy for search engines to crawl.
If you run a specialized image or video portal and truly need dedicated media sitemaps, you can safely use this plugin alongside other SEO tools that handle media-specific indexing. -
Do I need to ping Google or other search engines when the sitemap is updated?
-
No. Since 2023, Google has officially discontinued support for the legacy ping endpoint.
Search engines now automatically discover and re-fetch sitemap files listed in your robots.txt or previously submitted via Search Console.Your sitemap will be crawled regularly without any manual “ping”.
Adding extra HTTP requests such ashttps://www.google.com/ping?sitemap=https://example.com/sitemap.xmlno longer has any effect and is completely optional.
If you want to ensure fast discovery, just include this line in your robots.txt:
Sitemap: https://example.com/sitemap.xmlThat’s all you need — modern search engines periodically check robots.txt and automatically detect sitemap updates.
-
Which plugins are supported?
-
- WooCommerce (version 2.6 and above) — simple & grouped products
- DW Question Answer (version 1.4.3.4 and above) — published Q&A pages
- Any plugin that registers a public custom post type or public custom taxonomy — detected automatically.
This means the plugin can support almost any third-party extension (portfolio plugins, directory listings, events, job boards, and more), as long as the post type or taxonomy is registered in WordPress as public.
-
How can I verify that dynamic mode works?
-
Open
https://yoursite.com/sitemap.xmlin browser developer tools or run:curl -I https://yoursite.com/sitemap.xmlYou should see the header
X-LWSGP-Mode: dynamicin the response.
If a physicalsitemap.xmlfile exists in the site root, the server may serve it directly (without headers). The plugin will show a warning in the admin panel and let you delete that file.You can also enable diagnostic comments in the settings.
-
Do I need to edit robots.txt?
-
The plugin does not touch your
robots.txtautomatically.
It is recommended to add the following line manually:Sitemap: https://example.com/sitemap.xmlThis helps search engines (Google, Yandex, Bing, etc.) to discover your sitemap faster.
-
How can I limit taxonomy calculation for very large sites?
-
This is an advanced option, not required for normal sites.
By default, the plugin calculates<lastmod>for all selected taxonomy term archives (categories, tags, custom taxonomies) using a single optimized SQL query per taxonomy. This is safe and efficient in most cases.
However, on extremely large sites with tens of thousands of terms, you may want to set a soft cap to avoid heavy database operations.
You can do this with a simple filter in your theme’sfunctions.phpor in a small custom plugin:add_filter('lwsgp_tax_lastmod_cap', function() { return 5000; // maximum number of terms per taxonomy for <lastmod> });If the number of terms exceeds this cap, the plugin will still include the term URLs in the sitemap, but without
<lastmod>. This prevents potential performance issues on very large sites. -
How is the sitemap generated?
-
The plugin supports both File and Dynamic modes, each with its own generation method.
File mode (single or split)
A complete list of URLs is built in memory and then written to disk as static XML files.
This approach has the lowest runtime cost for visitors because the web server serves the files directly.Dynamic mode (on-the-fly)
The sitemap is generated dynamically when requested and cached for speed.- Dynamic single-file (no split) — builds the full list of URLs in memory and returns a single XML file.
- Dynamic + Split — when splitting is enabled, you can choose between two engines:
- Dynamic-Single (default) — fast in-memory build for both index and parts; recommended for most sites.
- Dynamic-Part-Stream — streaming generation with bounded memory for both index and parts; ideal for very large sites.
Automatic engine fallback
By default, automatic fallback is disabled.
Administrators can enable it by using the filter below:
// Return 0 to disable automatic fallback (default). // Return a positive integer to enable fallback when total URLs exceed the threshold. add_filter('lwsgp_dynamic_single_threshold', function () { return 0; // no automatic fallback by default });Both modes produce identical XML output — they differ only in how data is processed and delivered.
-
What is the «Robots noindex, follow» header and why is it available only in Dynamic mode?
-
This is an advanced option, intended for SEO-sensitive configurations.
When enabled, the plugin sends the following HTTP header for dynamically generated sitemap files:
X-Robots-Tag: noindex, followThis tells search engines not to index the sitemap itself, but still to follow the links inside it.
In practice, this prevents the sitemap XML from appearing in search results, while ensuring that all listed URLs are still crawled and indexed as usual.The header is available only in Dynamic mode, because:
- In Dynamic mode, sitemaps are served through PHP (not as static .xml files), so the plugin can safely inject custom HTTP headers.
- In File mode, the sitemap is a physical XML file on disk. Static files are served directly by the web server (Apache, Nginx, etc.), and PHP cannot modify HTTP headers for them.
If you need the same behavior in File mode, you can manually add this header in your web server configuration, for example in .htaccess:
<FilesMatch "sitemap.*\.xml$"> Header set X-Robots-Tag "noindex, follow" </FilesMatch>For most sites, leaving this option disabled is perfectly fine. It is recommended mainly for developers, SEO specialists, or agencies who prefer explicit control over how search engines handle sitemap URLs.
Отзывы
Нет отзывов об этом плагине.
Участники и разработчики
«Lightweight Sitemap Generator» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:
Участники«Lightweight Sitemap Generator» переведён на 1 язык. Благодарим переводчиков за их работу.
Перевести «Lightweight Sitemap Generator» на ваш язык.
Заинтересованы в разработке?
Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.
Журнал изменений
1.0.19
- Unified all sitemap cleanup routines under a single WP_Filesystem-aware deletion model for better consistency and security.
- Improved reliability of file removal on non-DIRECT filesystem methods (FTP, FTPS, SSH2).
- Enhanced fallback logic and cache clearing after deletion to ensure accurate file state detection.
1.0.18
- Improved compliance with File operations via WP_Filesystem (with safe fallback) policy.
- Replaced direct unlink() calls with wp_delete_file() for better WordPress coding-standards compatibility.
- Introduced smart filesystem helpers (lwsgp_exists_smart() and lwsgp_glob_smart()) — automatic DIRECT/FS detection without performance loss.
- Minor internal optimizations for faster permission checks and safer file deletions.
1.0.17
- Enhanced reliability: filesystem permission probe cache now resets after both successful and failed sitemap generation — prevents outdated permission status in the admin panel.
- No behavioral change for users: generation logic, performance and compatibility remain unchanged.
1.0.16
- Added 1-hour transient cache for filesystem write-permission checks (improves performance when opening plugin settings).
1.0.15
- Code style refactoring — unified indentation and alignment for better readability.
- Improved inline documentation and function-level comments.
- Admin UI HTML updated to follow modern HTML5 standards (no functional changes).
1.0.14
- Codebase cleaned and formatted for WordPress standards.
- Settings update: the «Send X-Robots-Tag: noindex, follow» option is now available only for Dynamic mode (hidden for File mode).
- Added dismissible (×) buttons to all admin notices for a cleaner and consistent WordPress-style interface.
- Minor internal stability improvements and refactoring for consistency across PHP 7.0–8.4 / WordPress 4.8–6.8.
1.0.13
- Reworked admin interface and refreshed visual design.
- Optimized preview and on-disk sitemap reading — physical files are no longer rescanned on every action.
- Added new option to disable the Conflict Checker (SEO aggregator detection).
- Added optional X-Robots-Tag: noindex, follow header (can be toggled in settings).
- Diagnostic XML comments now include response headers.
- Numerous minor improvements, code clean-ups and bug fixes.
1.0.12
- Added «Preview auto-calc» option in settings (off by default) — administrators can choose between automatic or manual preview calculation.
- Improved admin page performance on large sites — preview no longer recalculates automatically unless enabled.
- Unified button labels: «Calculate» for first run, «Recalculate» after preview exists.
- Removed unnecessary write-permission checks in Dynamic mode (only checked in File mode).
- Unified admin notices — all messages now use consistent non-dismissible style.
- Fixed issue where «Last calculated: N/A» could remain after manual preview rebuild.
- Code cleanup and comments harmonized for PHP 7.0–8.4 compatibility.
1.0.11
- Added streaming preview engine (100% identical to XML generation) — now preview counts are perfectly matched to real sitemap output.
- Replaced old full-memory preview with new bounded-memory streaming counter for better performance on large sites.
- Improved stability of admin operations with transient locks and strict sanitization.
- Minor internal refactoring and code cleanup (PHP 7.0–8.4 compatibility).
- Added automatic plugin version display in the admin header (auto-detected from plugin header).
- Improved admin «Language» selector.
- Optimized dynamic sitemap index generation (single-pass streaming for Dynamic-Part-Stream).
- Improved PRG workflow for «Recalculate» action.
- Added selectable dynamic engines for split mode:
- Dynamic-Part-Stream (safe streaming)
- Dynamic-Part-Single (fast in-memory with auto-fallback)
1.0.10
- Refactored generators for PHP 7+ compatibility and stability.
- Replaced legacy isset(…) patterns with modern ?? operator.
- Added return types for private methods and unified error handling.
- Code optimization and internal refactoring for better performance and maintainability
1.0.9
- Raised minimum PHP version to 7.0 for better generator stability.
1.0.8
- UI/UX: Improved spacing, typography, and overall admin consistency.
- Security: Enhanced sanitization and stricter HTTP validation.
- Performance: Added ETag/304 caching and a new streaming split mode for large sitemaps.
- Code Quality: Better escaping, PHPCS compliance, and safe fallbacks.
1.0.7
- UI: Unified style for “Preview” and “On-disk” sections — shorter, cleaner layout for easier reading.
1.0.6
- UI: Unified homepage mode names — now “Smart (recommended)”, “Conservative (use front page modified date)”, and “Fast (always use ‘Now’)”.
- UI: Renamed the admin sidebar menu item to “LW Sitemap” for a compact, single-line label.
- UI: Redesigned the admin stats area — “Total entries (preview)” and “On-disk sitemap (current file)” now display side by side for better readability.
- UX: Preview (“Total entries”) is now automatically calculated in both modes (File and Dynamic) and cached for 1 hour. Added “Recalculate preview” button for manual refresh.
- Perf: Small optimization in admin preview recalculation.
- Stability: Verified compatibility with WordPress 4.8 – 6.8.3 and PHP 7.0 – 8.4.
1.0.5
- I18N: Removed bundled
.po/.mofiles from the plugin package to avoid conflicts with community translations. - I18N: Improved language loading logic — plugin now prioritizes official WordPress.org translation packs (GlotPress). Falls back to local
/languagesfolder only if no global translation exists. - UX: No functional changes. This release ensures consistent and up-to-date translations for all users.
1.0.4
- UX: Added a quick “Generate / Update sitemap” button at the top of the settings screen (File mode only).
- New: “Conservative” homepage mode — uses the modified time of the static front page (falls back to Smart if the homepage is the posts index).
- Improved: “Smart” homepage now also considers ENABLED custom post types (detected) when calculating freshness. Custom taxonomies are intentionally ignored (performance-friendly).
- I18N: Added a new translatable string for the “Conservative” mode.
- No breaking changes. Fully backward-compatible with existing settings.
1.0.3
- Performance: bulk calculation of taxonomy in a single SQL per taxonomy (massively faster on large sites).
- Safety: optional soft cap for taxonomy via filter
lwsgp_tax_lastmod_cap(default 0 = unlimited). - No breaking changes. Existing behavior preserved; features remain off by default.
1.0.2
- New: support for any detected custom post types (CPT) and custom taxonomies — can be enabled in settings.
- New:
<lastmod>support for categories, tags, author archives, and date archives (based on the latest modified post). - Improved: admin UI now shows detected CPT/taxonomies with individual checkboxes (off by default).
- Improved: translation support — added translators’ comments for placeholder strings.
- Fixed: consistency of
<lastmod>timestamps across all archive types.
1.0.1
- Improved security: removed use of
FILTER_UNSAFE_RAW, added stricter sanitization of server variables. - Added clearer HTTP diagnostic headers (including
X-LWSGP-Cache: FILEfor file mode). - Updated prefixes to avoid collisions (all code, options and transients now use
lwsgp_). - General code cleanup and small stability fixes.
1.0.0
- First stable release.
- Added smart homepage
<lastmod>calculation (blocks, WooCommerce, DW Q&A). - Added split mode (sitemapindex + multiple parts up to 50,000 URLs each).
- Added better conflict detection and admin notices.
- Added diagnostic headers and comments for easier debugging.
- Improved caching in dynamic mode (ETag, Last-Modified, HIT/MISS).
- Improved security checks and permission handling.
- Many small fixes and code cleanup.
- Based on previous 0.1 (initial release) and 0.2 (major improvements).


