Published page, expired, then unexpired and set for future publish shows on the site

Vote:
 

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:

  1. Create a page
  2. View the page on the site to make sure it's visible
  3. (optional) Expire the content
  4. (optional) View the page on the site to make sure that it's no longer visible (may need to log out)
  5. (optional) Remove the expiration date of the page
  6. (optional) View the page on the site to make sure it's visible again
  7. Schedule the page for publish in the future
  8. View the page on the site to find out that even though it's scheduled for the future, it's available for the public right now

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?

#217645
Feb 26, 2020 21:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.