When content editors are adding content within Umbraco, they might not always want to instantly publish every page to the website straightaway. Instead of instant publishing, pages can be scheduled. tIt is also possible to simply save pages in Umbraco. When a page is saved and not published, from my experience it's really easy to forget. An unpublished page won’t be visible on your site and by default, Umbraco will not remind you that the page needs some attention.
One way of levelling up the editor experience in Umbraco is creating a custom admin plug-in that wills all the unpublished pages to help make the content editors' lives a little easier. On the majority of sites, I've worked on, this type of functionality is always greatly welcomed by the editors In this tutorial you will learn how to do this 😲.
If you only need to find all the unpublished pages of a certain document type, you can use the
GetContentOfContentType() method available on the
ApplicationContext helper. Normally I would advise against
ApplicationContext as it has performance issues. The Content Service API, which is slower as it talks to the database directly. As performance won't be as big of an issue in a backend extension compared to the website, the content service is an acceptable API to use.
We now have a list of pages that are of type
IContent has limited published information associated with it, however, you can use filter out non-published pages using the 'Published' property.
When you work with the content type service API, you will get published and unpublished pages back, which you can filter out using the 'Published' property. This is all the code you need to get going. You can read how to create the backend admin panel here. Happy Coding 🤘