automattic/msm-sitemap
Composer 安装命令:
composer require automattic/msm-sitemap
包简介
Comprehensive sitemaps for your WordPress.com VIP site.
README 文档
README
Stable tag: 1.5.6
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: sitemap, xml, seo, performance, multisite
Contributors: metro, automattic, alleyinteractive, makermedia, 10up, garyj
High-performance XML sitemaps for large-scale WordPress sites. Built for speed, extensibility, and reliability. Metro Sitemap generates robust, scalable XML sitemaps for WordPress sites of any size. Designed for high-traffic and enterprise environments, it ensures your content is discoverable by search engines without slowing down your site.
At a Glance
- Fast, reliable XML sitemaps for large and small sites
- Asynchronous generation avoids timeouts and memory issues
- Supports custom post types (see FAQ)
- Multisite compatible
- WP-CLI support for advanced management
- Extensible via hooks and filters (see developer docs)
- Admin UI for stats, manual actions, and cron management
- Browser-friendly XSL styling with independent stylesheet endpoints
Installation
- Upload the plugin folder to
/wp-content/plugins/or install via the WordPress admin. - Activate the plugin through the 'Plugins' menu in WordPress.
- (Optional) Visit Tools > Sitemap in the admin for stats and manual actions.
- Sitemaps will be generated automatically in the background.
Usage
- Your sitemap index will be available at
/sitemap.xml(e.g.,https://example.com/sitemap.xml). - Sitemaps are generated in the background and updated as you publish new content.
- The admin UI (Tools > Sitemap) provides stats and lets you manually trigger generation if needed.
Automatic Updates
By default, automatic sitemap updates are disabled to prevent resource issues on large sites. To enable automatic updates:
Via Admin UI:
- Go to Tools > Sitemap in your WordPress admin
- In the "Cron Management" section, click "Enable Automatic Updates"
- Once enabled, you can use the "Generate" section to manually trigger sitemap generation
Via WP-CLI:
wp msm-sitemap cron enable
Important: Automatic updates can use significant resources on sites with many posts. For large sites, consider using date-targeted WP-CLI commands instead (see below).
Frequently Asked Questions
Why isn’t my custom post type included in the sitemap?
By default, only the post post type is included. To add custom post types (like page, news, or others), see the Developer Guide.
How do I include posts with a custom status?
By default, only published posts are included. You can change this via a filter. See the Developer Guide.
How do I regenerate the sitemap?
Sitemaps are generated automatically, but you can:
- Use the admin UI (Tools > Sitemap) to trigger a manual rebuild
- Use WP-CLI commands (see below)
Does it work on multisite?
Yes! Each site in your network will have its own sitemaps. The plugin can be network-activated.
How do I exclude specific posts or dates?
You can filter which posts or dates appear in the sitemap using hooks—see the Developer Guide.
Where is the sitemap stored?
Sitemap XML is stored in a custom post type (msm_sitemap) and served on-demand for fast performance.
Can I customize the number of posts per sitemap?
Yes, this is filterable. See the Developer Guide.
How do I disable the XSL styling for sitemaps?
If you want to serve plain XML without browser styling, you can disable the XSL stylesheet references:
add_filter( 'msm_sitemap_include_xsl_reference', '__return_false' );
For more XSL customization options, see the Developer Guide.
WP-CLI Commands
Metro Sitemap supports advanced management via WP-CLI. Here are the most common commands:
Core Commands
- generate: Generate sitemaps for all or specific dates.
wp msm-sitemap generate --all
- delete: Delete sitemaps for all or specific dates.
wp msm-sitemap delete --date=2024-07
- list: List sitemaps.
wp msm-sitemap list --format=json
- get: Get details for a sitemap by ID or date.
wp msm-sitemap get 579
- validate: Validate sitemaps for all or specific dates.
wp msm-sitemap validate --all
- export: Export sitemaps to a directory.
wp msm-sitemap export --all --output=/tmp - recount: Recalculate and update the indexed URL count for all sitemap posts.
wp msm-sitemap recount
- stats: Show sitemap statistics (total, most recent, etc).
wp msm-sitemap stats --format=table
Cron Management Commands
- cron enable: Enable automatic sitemap updates.
wp msm-sitemap cron enable - cron disable: Disable automatic sitemap updates.
wp msm-sitemap cron disable
- cron status: Check the status of automatic updates.
wp msm-sitemap cron status
- cron reset: Reset cron to clean state (for testing).
wp msm-sitemap cron reset
For the full list of commands, options, and legacy command mapping, see DEVELOPERS.md.
Support
- GitHub Issues (for bug reports and feature requests)
- WordPress VIP Support (for WPVIP customers)
Credits
Metro Sitemap is a joint collaboration between Metro.co.uk, WordPress VIP, Alley Interactive, Maker Media, 10up, and others. Special thanks to all contributors.
Changelog
See CHANGELOG.md for a full history of changes.
License
GPLv2 or later. See LICENSE for details.
Developer Documentation
For advanced customization, see DEVELOPERS.md.
automattic/msm-sitemap 适用场景与选型建议
automattic/msm-sitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 211.41k 次下载、GitHub Stars 达 86, 最近一次更新时间为 2024 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 automattic/msm-sitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 automattic/msm-sitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 211.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 86
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2024-12-14