I was looking for an answer and came across this comment which doesn't seem to work in Epi 11 anymore: https://world.episerver.com/forum/legacy-forums/Episerver-7-CMS/Thread-Container/2013/11/How-to-work-with-publish-date-on-a-page/#80995
I'm finding that if you previously publish a page, you can't go back and set the scheduled publish because the page will always show on the site. The only option is to expire the content so it doesn't show on the site, but now you can't schedule the publish because of the error "Expiration date cannot be prior to the published date." It will require a manual publish in the future to remove the expiration and live publish the content.
Steps to reproduce:
I have the following code in place to hopefully catch unpublished content, but once it's published it always has a publish date. It's based on https://www.jondjones.com/learn-episerver-cms/episerver-developers-tutorials/episerver-api-explained/how-to-check-if-an-episerver-page-is-published-or-not/
return allItems.Where(x => !x.IsDeleted && _publishState.Service.IsPublished(x, PagePublishedStatus.Published));
How can I get the content to not show when it is scheduled for publish regardless if it was previously published or not?