Try our conversational search powered by Generative AI!

Praful Jangid
Feb 6, 2021
  2103
(4 votes)

Bulk publishing of unpublished content items/nodes

In Episerver, we don't have any built in feature that allows us to publish full site (bulk items) in one go. We recently faced one challenge to publish all category nodes.

In CMS, we have an option of Project to perform bulk item update (change of state or publish). But in commerce we don't. And, in our case, we did import of content using custom code and a huge number of items were not published (even we used the SaveAction.Publish).

Then, we decided to write custom code to do that (via scheduled job). And, after doing some RnD, I found that the following Method returns only published items.

ContentRepository.GetChildren<T>(ContentReference contentLink)

Then, the question is how to retrieve the unpublished node/items?

Here is the answer, use the Language option with GetChildren method.

ContentRepository.GetChildren<NodeContent>(parentNode.ContentLink, LanguageSelector.AutoDetect(true))

This is just a trick to get the unpublished items/nodes. And, for bulk publish, you can use the

ContentRepository.Publish(listOfPages);

That's it. You are done.

Thanks

Feb 06, 2021

Comments

Please login to comment.
Latest blogs
Azure AI Language – Extractive Summarisation in Optimizely CMS

In this article, I demonstrate how extractive summarisation, provided by the Azure AI Language platform, can be leveraged to produce a set of summa...

Anil Patel | Apr 26, 2024 | Syndicated blog

Optimizely Unit Testing Using CmsContentScaffolding Package

Introduction Unit tests shouldn't be created just for business logic, but also for the content and rules defined for content creation (available...

MilosR | Apr 26, 2024

Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024