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

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

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

isaactopo/xmlsitemap

最新稳定版本:0.2.2

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

统计信息

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

GitHub 信息

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

其他信息

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