定制 svc/sitemap-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

svc/sitemap-bundle

最新稳定版本:1.3.0

Composer 安装命令:

composer require svc/sitemap-bundle

包简介

Bundle to create easy XML sitemaps and robots.txt files

README 文档

README

CI Latest Stable Version License Total Downloads PHP Version Require

This bundle creates easy XML sitemaps and robots.txt files in a Symfony application

Features

  • XML Sitemap Generation with full support for lastmod, changefreq, and priority
  • PHP Attributes Support - Modern #[Sitemap] and #[Robots] attributes for type-safe configuration (PHP 8+)
  • Multi-language Support with hreflang alternate URLs
  • robots.txt Generation with optional sitemap reference
  • Static & Dynamic Routes via event system
  • Security Validation - Prevents XSS (javascript:, data: schemes blocked)
  • UTF-8 Validation - Ensures all content is valid UTF-8
  • Size Limits - Automatic validation (50,000 URLs / 50MB per sitemap)
  • Console Commands for easy generation
  • GZIP Support for compressed sitemaps

Short examples

sitemap.xml

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://shorter.li/svc-contactform/de/contact/</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.2</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/svc-contactform/de/contact/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/svc-contactform/en/contact/"/>
  </url>
  <url>
    <loc>https://shorter.li/de/</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/de/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/en/"/>
  </url>
  <url>
    <loc>https://shorter.li/login/de</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.1</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/login/de"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/login/en"/>
  </url>
</urlset>

robots.txt

User-agent: google
Allow: /
Allow: /de/
Allow: /en/
Allow: /public
Disallow: /admin

User-agent: bing
Allow: /
Disallow: /de/
Disallow: /en/
Disallow: /admin

User-agent: *
Disallow: /

Sitemap: https://example.com/sitemap.xml

Documentation

Sitemap

Robots.txt

Note

Many thanks to the creators of the PrestaSitemapBundle. From there I got many ideas and sometimes also some code...

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-29