sebastiaan
(Sebastiaan Janssen ⚓)
March 4, 2025, 8:25am
6
You’ll benefit from this feature coming in 13.8 then:
v13/dev
← v13/feature/force-republish-descendents
opened 01:54PM - 06 Feb 25 UTC
### Prerequisites
- [X] I have added steps to test this contribution in the d… escription below
Resolves: https://github.com/umbraco/Umbraco-CMS/issues/13739
### Description
We currently have a single option on the "Publish descendants" dialog, where an editor can "Include unpublished content items". There are cases though we we also want to force a publish even if there are no changes to publish (so notification handlers can fire, indexes can get rebuilt etc.).
So this PR introduces a second option.

In code we have a `force` parameter that gets passed up to the content service. I've split that into two so we can be be more explicit about what exactly we are forcing (publish of unpublished or publish of unchanged).
**To Test:**
- I tested this with the help of a notification handler, logging out what is published.
```
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
namespace Umbraco.Cms.Web.UI.Custom;
public class ContentPublishedNotificationHander : INotificationHandler<ContentPublishedNotification>
{
private readonly ILogger<ContentPublishedNotification> _logger;
public ContentPublishedNotificationHander(ILogger<ContentPublishedNotification> logger) => _logger = logger;
public void Handle(ContentPublishedNotification notification)
{
foreach (Core.Models.IContent entity in notification.PublishedEntities)
{
_logger.LogInformation($"Published content: {entity.Name} ({entity.Id})");
}
}
}
```
- I then carried out tests for the following scenarios, and received the expected results.
Scenario | No Options Selected | Force Unpublish Selected | Force Re-Publish Selected | Both Options Selected
--- | --- | --- | --- |---
3 children, all published with no changes | Nothing published | Nothing published | Parent and 3 children published | Parent and 3 children published
3 children, 2 published with no changes, 1 unpublished | Nothing published | Single unpublished child is published | Parent and 2 published children are published | Parent and 3 children published
3 children, 2 published with no changes, 1 published with changes | Single changed child is published | Single changed child is published | Parent and 3 children published | Parent and 3 children published
3 children, 1 published with no changes, 1 unpublished, 1 published with changes | Single changed child is published | Single changed child and single unpublished child is published | Parent and 2 published children are published | Parent and 3 children published
- Consider overloads and obsoletions introduced to avoid breaking changes.
What happens when you do a publish all + descendants is that (for performance reasons) only the descendants that have unpublished changes get published.
But it seems that… something didn’t get rebuilt properly after your upgrade, be it the cache, or the indexes. I would suspect rebuilding all of NuCache plus rebuilding indexes might do the trick.
If not, and you can’t wait for 13.8 (April 10) then it would be some custom code you need to write to “hard-publish” each node.
1 Like