Pelican: Hidden status for articles

Created on 28 May 2016  Â·  11Comments  Â·  Source: getpelican/pelican

I hesitated before creating this issue, since there are at least two workarounds for this:

  • Changing file extension to something like .md~
  • Just using status: draft

But hidden has a slightly different semantic value than draft, plus if pages can be _hidden_ (without the notion of being a _draft_), why can't some posts too? I believe combining draft and hidden status to be an alias of each other would be pretty reasonable.

enhancement

Most helpful comment

Semantically, I think there's two distinct ideas being discussed here. Like with pages, a hidden post would be generated but not included in the index page (and perhaps the archive as well). In other words, you could still link to a hidden post via example.com/blog/2016/06/my-post/, much like you can link to a hidden page via example.com/page.

On the other hand, there could also be an unpublished status, where Pelican would ignore the file completely. One possible use case for this could be people who keep their Pelican content in a Git repository that automatically builds on pushes; this would allow them to iteratively work on a post without pushing anything new to their live site. It's pretty niche, but I think having a unpublished → draft → published "workflow" could be valuable.

All 11 comments

what would a hidden post do?

Personally I'd like to mark some old posts as hidden so that they no longer appear on the main site (obsolete information etc.), but I can access them in the file system.

Semantically, I think there's two distinct ideas being discussed here. Like with pages, a hidden post would be generated but not included in the index page (and perhaps the archive as well). In other words, you could still link to a hidden post via example.com/blog/2016/06/my-post/, much like you can link to a hidden page via example.com/page.

On the other hand, there could also be an unpublished status, where Pelican would ignore the file completely. One possible use case for this could be people who keep their Pelican content in a Git repository that automatically builds on pushes; this would allow them to iteratively work on a post without pushing anything new to their live site. It's pretty niche, but I think having a unpublished → draft → published "workflow" could be valuable.

I’ve been working around this with some ropey template code and monkey-patching bits of the feed generator. I’d be happy to have a go at incorporating this into Pelican core, if nothing else so I can tidy up my local install. :-)

I don’t have much free time this weekend, but I’ll try to put a patch together at some point.

@rr- / @alexwlchan: Is this something you would like to work on implementing?

+1. My hack for now: I’ve set the article to draft and then configured a permanent redirect from the old URL to the draft URL in the Nginx I use to serve the files.

@Telofy you can setup DRAFT_URL/DRAFT_SAVE_AS same as ARTICLE_* to get rid of redirects.

EDIT: If you want to have unpublished like status where they are completely ignored then you could assign an extension (e.g. somearticle.rst.unpublished) to it and use IGNORE_FILES setting.

@avaris, thank you! That’s very convenient! (Since no one knows the slugs of new actual drafts, they remain hidden too.)

This issue has been around for a while without much movement. If someone wants to submit a proposed implementation, we are happy to review pull requests.

Since @GiovanH has expressed an interest in implementing Status: hidden for articles, I am re-opening this issue.

If anyone is currently using Status: hidden for articles (which reportedly causes articles not to be generated at all), then I suggest finding another solution, since that seems like unintended behavior that I don't feel we need to preserve.

https://github.com/getpelican/pelican/pull/2866 is ready for review, although I'll poke at it a couple more times for hardening's sake.

Was this page helpful?
0 / 5 - 0 ratings