thepixeldeveloper/sitemap-bundle

一个集成了thepixeldeveloper/sitemap的Symfony Bundle。

3.0.6 2018-06-25 12:41 UTC

This package is not auto-updated.

Last update: 2024-09-15 03:24:08 UTC


README

pipeline status coverage report License Latest Stable Version Total Downloads

一个集成了thepixeldeveloper/sitemap的symfony bundle。

安装

  1. 作为composer依赖项要求

    composer require "thepixeldeveloper/sitemap-bundle"
  2. 注册bundle

    # app/AppKernel.php
    public function registerBundles()
    {
        $bundles = [
            new Thepixeldeveloper\SitemapBundle\ThepixeldeveloperSitemapBundle(),
        ];
    }
  3. 导入路由

    # app/config/routing.yml
    thepixeldeveloper_sitemap_bundle:
        resource: "@ThepixeldeveloperSitemapBundle/Resources/config/routing.yml"
        prefix:   /
  4. 定义XML文件将被转储的位置。

    thepixeldeveloper_sitemap:
        directory: '%kernel.project_dir%/var/sitemaps'

使用方法

  1. 创建一个事件监听器,用于监听theixeldeveloper_sitemap.populate事件。向Urlset集合添加URL。

  2. Sitemaps的生成方式如下

    ./bin/console thepixedeveloper:sitemap:dump
  3. 您的sitemap将在以下位置可用:https://domain.tld/sitemap.xml