PiranhaCMS / piranha.core

Piranha CMS is the friendly editor-focused CMS for .NET that can be used both as an integrated CMS or as a headless API.
http://piranhacms.org
MIT License
2.01k stars 560 forks source link

post end date #1029

Closed haidersafaa closed 4 years ago

haidersafaa commented 4 years ago

Hi can we add post end date so the post not shown in front side after this date

tidyui commented 4 years ago

Generally I consider this to be a bad idea. The main purpose of building a website is to get people to read your content. After your post is published it is hopefully indexed by search engines and linked from other websites. If you unpublish stuff on a regular basis you end up with dead links, bad indexation and a lot of aliases.

It would however be interesting to hear your use case for this.

Regards

goranhell commented 4 years ago

I maintaining the website for a swim team. The website is used as a information channel. Currently I'm using BlogEngine.Net, where I have done adaptions to meet my needs (unfortunately some adaptions is in the core components) I use a feature, for invitation to our own competitions and similar (with an enddate). I have a section 'Aktuellt' for information that are time limited, for instance information to swimmers and their parents about competitions that we participate in (PM, startlista etc.., also with an enddate). And also a section for latest news, which is like a normal blog. (see attached picture) S02

Since BlogEngine is now a bit outdated I'm looking towards Piranha instead. While playing around I think I can solve the issues above without adapting the core, but it would, of course, be handy if things like 'end date' is supported out of the box.

For me PiranhaCms looks great and just need to get a bit more familiar and doing my adaptions.

goranhell commented 4 years ago

By the way, I understand your comment, but for me, since I'm doing this in my spare time, it's about minimizing the time I (and a couple of others, also in their spare time) need to spend maintaining the site.

i-love-code commented 4 years ago

I would agree with @tidyui that expiration that leads to dead links is frowned upon, but expiration in general is a feature that we also see used very often in event-driven information or registration pages as seen in this example.

It's a commonly desired and leveraged feature in the CMS platform we work with primarily (Episerver) and would love to see expiration as an option.

i-love-code commented 4 years ago

If expiration is implemented, I'd love to see the ability to specify an Alias URL to be implemented once the content expires for SEO concerns on direct hits/links/bookmarks.

I'm also open to contributing expiration features should it be added/agreed upon for Piranha.

tidyui commented 4 years ago

Like you all say it depends on what you use it for. If we for example look at the example from @goranhell it looks like the items below “Aktuellt” are only used as parts of that page and are not browsable (or indexed) by themselves. If this is the case then there’s no harm in unpublishing them either.

I know this is how composite pages are handled in many systems but it’s not my favorite content structure as it is extremely technical and hard for a non developer content creator to see what’s going on.

Instead, for this scenario, my suggestion would be that the content pieces under Aktuellt would be custom blocks and that we would add visibility dates to blocks. This would mean that you would be able to add elements to pages and posts, like events and banners, that should only be visible for a specified period of time.

Does this make sense or have I misunderstood the use-case?

Regards

haidersafaa commented 4 years ago

dears may be you there is misunderstood ,I say not to shown the post on the front end not delete the post may be i use the end date and show some content refer this post is ended or hide it from front end or change it category to show it with ended content

goranhell commented 4 years ago

As @haidersafaa says it's about hiding, not deleting.

rizman commented 4 years ago

I concur that this would be a useful feature. The point is not to delete the post but to hide it from the newest/currently relevant posts feed from the first page. You could still have another page listing all the posts, even if the enddate has passed. Any search engine links to the post itself would stay intact. In the end it's just a matter of having (pseudo code)

if (post.endDate <= DateTime.Now) post.show() in your view.

tidyui commented 4 years ago

I see your point @rizman but as the rest of the code is implemented, IsPublished would be false if the end date would be passed which would by default make it inaccessible without preview permissions. What you’re talking about is having a region or block that lists posts where you’re able to set a visibility period for each post in that context. I have no objections with that feature and think it’s a nice and flexible solution to be able to highlight certain posts under different time periods.

Best regards

tidyui commented 4 years ago

Just to clarify, in my world, when something is unpublished it is invisible for everyone that is not an admin in every context. This is for an unauthenticated user the same as the post being deleted.

Hiding, or removing the post from a specific context is a completely different thing.

rizman commented 4 years ago

@tidyui I totally agree with you. I'm not 100% sure if what I suggested is what the OP was asking for. What I suggested is exactly as you said: it limits visibility in time in the view without unpublishing. Of course if the OP's End Date would mean unpublish, that would rather be a scheduling feature. And that brings with it the problems you already mentioned.