Skip to content

sitemap.xml is empty after cache:clear in Multisite #508

@o1y

Description

@o1y

Bug description

In a Multisite setup, the sitemap behaves inconsistently and becomes completely empty after clearing the cache.

How to reproduce

  1. Have a multisite setup with a structured collection and localized entries
  2. Run php please cache:clear
  3. Open sitemap.xml

Result: /sitemap.xml is empty (0 entries).

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.53.0
PHP Version: 8.4.16
Composer Version: 2.8.10
Environment: local
Debug Mode: ENABLED
URL: statamic-seo-test.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
Sites: 2 (Statamic, German)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.4.1 PRO

Statamic Addons
statamic/seo-pro: 7.1.1

Additional details

My PR statamic/cms#14031 revealed this bug for single-site setups, although the issue already existed before.

Another reproduction:

php please cache:clear
curl -s http://statamic-seo-test.test/sitemap.xml
php please tinker --execute="dump(Statamic\Facades\Entry::query()->whereNotNull('uri')->count());"

So when using ->whereNotNull('uri') all entries have null URIs (0 results).

Without the curl -s http://statamic-seo-test.test/sitemap.xml you'd get a correct count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions