lucacri/laravelsimplesitemap

一个用于创建简单网站地图的 Laravel 扩展包

3.0.0 2024-04-24 18:08 UTC

This package is auto-updated.

Last update: 2024-09-24 19:01:22 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

一个用于从特定 URL 创建网站地图的非常简单的扩展包

安装

您可以通过 composer 安装此扩展包

composer require lucacri/laravelsimplesitemap

您可以使用以下命令发布并运行迁移

php artisan vendor:publish --tag="laravelsimplesitemap-migrations"
php artisan migrate

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="laravelsimplesitemap-config"

这是已发布配置文件的内容

return [
    /*
     * Storage disk and path where to save the sitemap
     *
     */
    'save' => [
        'disk' => 'public',
        'path' => 'sitemap.xml'
    ],
    /*
     * The URL where your sitemap will be accessible.
     * This value will be used to inform Google of the changed sitemap
     *
     */
    'sitemap_url' => 'http://example.com/sitemap.xml',

    /*
    * An array of URLs to include in the sitemap
    * Example:
    *  [
            'loc'        => 'https://example.com',
            'changefreq' => 'weekly',
            'priority'   => 0.9
        ]
    */
    'urls' => [

        // example

        [
            'loc'        => 'https://example.com',
            'changefreq' => 'weekly',
            'priority'   => 0.9
        ]

    ]
];

可选地,您可以使用以下命令发布视图

php artisan vendor:publish --tag="laravelsimplesitemap-views"

使用方法

php artisan simplesitemap:create --ping-google

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近的变化。

致谢

许可证

MIT 许可证(MIT)。请参阅 许可证文件 获取更多信息。