Skip to content

feat: implement SEO settings with sitemap and robots.txt functionality - #2

Merged
roble merged 1 commit into
mainfrom
sc-722-sitemap
Sep 15, 2026
Merged

roble merged 1 commit into
mainfrom
sc-722-sitemap

Conversation

@roble

@roble roble commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

This pull request introduces a new, configurable SEO settings feature, allowing administrators to control the publication of sitemap.xml and robots.txt through the application interface. It also adds the infrastructure for dynamically generating sitemaps and robots rules, and updates dependencies to support these new features. The most important changes are grouped below:

SEO Settings Infrastructure:

  • Added a new SeoSettings settings class and corresponding migration to manage whether sitemap.xml and robots.txt are published, as well as their contents (src/Settings/SeoSettings.php, database/settings/0001_01_01_000013_create_seo_settings.php). [1] [2]
  • Introduced a Filament admin page for managing SEO settings, including toggles for enabling/disabling sitemap and robots.txt, and editing robots.txt rules (src/Filament/Admin/Pages/SeoSettings.php).

Sitemap and Robots.txt Endpoints:

  • Added a SitemapRegistry service for collecting sitemap contributors and building the sitemap on request, and registered it as a singleton in the service provider (src/Sitemap/SitemapRegistry.php, src/CoreServiceProvider.php). [1] [2] [3]
  • Implemented controllers for serving sitemap.xml and robots.txt, with logic to respect the configured settings and dynamically append the correct sitemap URL (src/Http/Controllers/SitemapController.php, src/Http/Controllers/RobotsController.php). [1] [2]

Testing and Dependency Updates:

  • Added comprehensive feature tests to verify correct behavior of the sitemap and robots.txt endpoints under various settings (tests/Feature/SitemapTest.php).
  • Updated dependencies, notably upgrading Filament, Laravel, and Spatie packages to support new features and ensure compatibility (composer.json).

Summary by CodeRabbit

  • New Features

    • Added SEO settings in the administration area for managing sitemap and robots.txt availability.
    • Added configurable robots.txt content, with automatic sitemap URL inclusion when applicable.
    • Added sitemap generation support for registered site URLs.
    • Added public /sitemap.xml and /robots.txt endpoints.
    • Disabled SEO endpoints now return a not-found response.
  • Tests

    • Added coverage for sitemap generation, robots.txt output, configuration options, and disabled states.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: af7f9c95-1d57-4310-adab-094c69bb2c37

📥 Commits

Reviewing files that changed from the base of the PR and between 62a51d5 and cc0dfb4.

📒 Files selected for processing (9)
  • composer.json
  • database/settings/0001_01_01_000013_create_seo_settings.php
  • src/CoreServiceProvider.php
  • src/Filament/Admin/Pages/SeoSettings.php
  • src/Http/Controllers/RobotsController.php
  • src/Http/Controllers/SitemapController.php
  • src/Settings/SeoSettings.php
  • src/Sitemap/SitemapRegistry.php
  • tests/Feature/SitemapTest.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds SEO settings, a Filament administration page, a sitemap contributor registry, and /sitemap.xml and /robots.txt endpoints. Feature tests cover enabled output, disabled responses, contributor URLs, and sitemap URL inclusion.

Changes

SEO endpoints

Layer / File(s) Summary
SEO settings and package contracts
composer.json, database/settings/..., src/Settings/SeoSettings.php
Adds the sitemap package, updates dependency constraints, and defines default sitemap and robots.txt settings.
Sitemap registry wiring
src/Sitemap/SitemapRegistry.php, src/CoreServiceProvider.php
Adds contributor registration and sitemap construction. The service provider registers the registry as a singleton.
SEO settings administration
src/Filament/Admin/Pages/SeoSettings.php
Adds controls for sitemap publication, robots.txt publication, and conditional robots content editing.
Sitemap and robots.txt serving
src/Http/Controllers/*, tests/Feature/SitemapTest.php, composer.json
Adds the sitemap and robots.txt controllers. Tests cover generated URLs, response content, optional sitemap links, and 404 responses when publication is disabled. Development dependency constraints are updated.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SitemapController
  participant RobotsController
  participant SeoSettings
  participant SitemapRegistry
  Client->>SitemapController: Request /sitemap.xml
  SitemapController->>SeoSettings: Read sitemap_enabled
  SitemapController->>SitemapRegistry: Build sitemap
  SitemapRegistry-->>SitemapController: Return populated sitemap
  SitemapController-->>Client: Return sitemap
  Client->>RobotsController: Request /robots.txt
  RobotsController->>SeoSettings: Read robots and sitemap settings
  RobotsController-->>Client: Return robots rules and optional Sitemap URL
Loading

Merge Risk: ⚪ Minimal · up to cc0df

The new SEO components follow the package’s application-owned routing model; no merge-blocking issue was confirmed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 8 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: configurable SEO settings, sitemap support, and robots.txt functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 8 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sc-722-sitemap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@roble
roble merged commit e5a9d44 into main Sep 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant