Sitemap ignores moderation state (Content Moderation)

Created on 13 November 2025, 2 days ago

Description

The module’s controller does not take moderation state into account when Content Moderation is enabled, causing nodes in non-public states (Draft, Needs Review, etc.) to appear in the sitemap.

Right now the filtering only checks the status field (published/unpublished), but in moderated workflows the actual publication state depends on moderation_state. This can lead to nodes being indexed when they shouldn’t be.

Steps to reproduce

  1. Enable Content Moderation.
  2. Create a workflow with non-published states (e.g., Draft).
  3. Create a node of a type included in the sitemap and leave it in Draft.
  4. Check the sitemap → the node appears.

Expected behavior

The sitemap should only include nodes that are actually published according to the active moderation workflow, not just by the status flag.

Technical proposal

  • Detect whether the node type is moderated.
  • Determine if the revision is publicly available using ModerationInformationInterface::isLiveRevision() or similar.
  • Exclude nodes in non-public moderation states even if status = 1.
📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain dcimorra 🇪🇸 Spain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024