Unpublish on particular date

Permalink
How in the world do you unpublish a page on a certain date.

Excluding from nav is not the same as unpublishing because you can still hit the page and google can index it.

Is there a feature to unpublish a page, how about a block? How about at a certain time.

for example: If we want a page to expire (unpublished) over the weekend or at noon on Monday, is there a mechanism for achieving this?

ministrycrm
 
adajad replied on at Permalink Reply
adajad
This is obviously harder than I thought, and I have not considered it before. It should, in my opinion, be built in with the system and might be in the future.

In the meantime have a look on these two links which might help you on the way:

http://www.concrete5.org/community/forums/usage/delete-pages-after-...

http://www.concrete5.org/documentation/how-tos/developers/automatic...
pvernaglia replied on at Permalink Reply
pvernaglia
It would be a nice option to have a page expiration date in the core. I think adaja is pointing you in the right direction to do it with a job or page controller. Either delete the page completely or set the exclude from nav and exclude from sitemap.xml attributes and run the sitemap job again.
ministrycrm replied on at Permalink Reply
ministrycrm
Here is my hack:
Step 1: Create an "date time" attribute and call it unpublish_date

Step 2: Put the following code in your header file
<?php
$unpublish = $c->getAttribute('unpublish_date');
if ($unpublish !='' && time() >= strtotime($unpublish)) {
    header("Location: /");
}
?>


This will redirect user to your homepage and avoid a 404 error.

Now if anyone has any ideas on how to unpublish an image from a slideshow, I am all ears.