ut8ia/yii2-sitemap-module

生成网站地图的模块

dev-master 2017-08-13 08:53 UTC

This package is auto-updated.

Last update: 2024-09-10 21:14:18 UTC


README

与 ut8ia/yii2-content-module 一起工作

URL 管理器配置

'sitemap.xml' =>'sitemap/sitemap/xml'

htaccess

RewriteCond $1 ^sitemap.xml
RewriteRule ^(.*)$ index.php

配置文件中的模块部分

  'sitemap' => [
            'class' => 'ut8ia\sitemapmodule\SitemapModule',
            'baseUrl' => 'https://www.i-wet.net',
            'sections' => [
                4 => ['prefix' => 'methods'],
                5 => ['prefix' => 'quality'],
                8 => ['prefix' => 'blog']
            ],
            'rows' => require(__DIR__ . '/sitemap.php')

网站地图配置

return [
    [
        'loc' => 'https://yourhost.net',
        'priority' => '0.8',
        'changefreq' => 'daily'
    ],
    [
        'loc' => 'https://yourhost.net/page',
        'priority' => '0.8',
        'changefreq' => 'daily'
    ]