isaactopo/xmlsitemap 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

isaactopo/xmlsitemap

Composer 安装命令:

composer require isaactopo/xmlsitemap

包简介

Kirby 3 Multilanguage XML Sitemap

README 文档

README

Is a powerful tool for managing and generating sitemaps that is designed to work with Kirby 3. This plugin provides a straightforward approach for creating XML Sitemaps, especially for sites with multiple languages. The multilingual support allows you to create separate URLs for each language, increasing the SEO performance of your website. The plugin creates one XML file with URLs to your website pages and images, automagically ✨ assigning their priority and last modification date which can be later easily readed by search engines.

If the website has only one language, a sitemap is generated in /sitemap.xml. With this new version (0.2.0), if the site has two or more languages, a <sitemapindex> is generated in sitemap.xml and all sub-sitemaps for each language with the following scheme: sitemap_en.xml, sitemap_es.xml, etc

How to install

Download

Download and copy this repository to /site/plugins/xmlsitemap

As a Git Submodule

git submodule add https://github.com/isaactopo/xmlsitemap.git site/plugins/xmlsitemap

With Composer

composer require isaactopo/xmlsitemap

Setup

The plugin works from the start, outputting all the listed pages from your website on yoursite/sitemap.xml and redirecting yoursite/sitemap to yoursite/sitemap.xml

Options and configuration

The plugin has 3 config options that you can tweak from your site/config.php file:

🙈 Ignore Pages

By default not listed pages are Ignored, but sometimes you will want to ignore specific pages. You are able to do it with:

'isaactopo.xmlsitemap.ignore' => ['error', 'legal'],

🎆 Include Images

You can inlude images with:

'isaactopo.xmlsitemap.includeImages' => true,

🧾 Include Specific Pages

If you have some factory-generated pages from your Routes or another page that you want to force-include you can do it with:

'isaactopo.xmlsitemap.addCollection' => function () {
    $professionals = kirby()->users()->filterBy('publish', true);
    $profiles = [];
    foreach($professionals as $professional){
        $profiles[] = Page::factory([
            'slug' => 'team/'.$professional,
            'template' => 'profile',
            'content' => [
                'author' => $professional,
                ]
            ]);
        }
    return $profiles;
},

🛗 Change Page Priority

The plugin generates an automatic priority according to the depth of each page (Thanks Bastian). But you may want to change the priority of some pages by hand. If so, you can do it by creating a new field in the blueprint of the page you want to include:

sitemapPriority:
    label: Sitemap Priority
    type:  number
    width: 1/2
    max:   1
    min:   0
    step:  0.1

priority panel field

This way the plugin will prioritise the input from the Panel.

Credits

isaactopo/xmlsitemap 适用场景与选型建议

isaactopo/xmlsitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.66k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2023 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 isaactopo/xmlsitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 isaactopo/xmlsitemap 我们能提供哪些服务?
定制开发 / 二次开发

基于 isaactopo/xmlsitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-17