preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Posts where status is set to draft don't show up in a blog, or a list of tags #584

Closed wbazant closed 4 years ago

wbazant commented 4 years ago

I've been thinking about the boolean flag alternative to status => published|draft, eg.

draft: true

but draft: false translates to {draft => 'false'} in currentYAML.pm` so steering people towards using YAML booleans will expose them to this bug.

Posts without a status will be correctly included but produce a warning, until https://github.com/preaction/Yancy/pull/71.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 86.182% when pulling 59eb26249d2bfc9c1275f4b5d4f3dd1143075874 on wbazant:v2 into e0f50d3b2e58aed49e2e9876acf482bb53fca097 on preaction:v2.

preaction commented 4 years ago

I considered the boolean, but I was imagining a future with more than just those two values for the status field: pending_approval for content awaiting approval/review, editing for content that's in editing, awaiting_approval_from_bob etc...

Thinking about it now it just feels like I'm creating complexity where it's not needed: If someone wanted a more complex content approval workflow, they could use the data: hash to do anything they wanted (and I've got a design for a Yancy plugin to do content approval workflows, which would then just need a Statocles configuration). Then the last step of approval would be to remove the draft: field and publish the site.

So, yeah, that's a good idea. I think Statocles should go the draft: ... route: It's definitely more user-friendly and easier to remember. That opens us up to that YAML.pm bug, but we could fix that in Yancy::Backend::Static by normalizing booleans to JSON::PP true/false booleans as any other part of Yancy would expect (since usually it gets its input from JSON::Validator). It's the backend's job to make sure what Yancy gets is sane and correct, and so the Static backend could smooth over the issues of loading YAML.

I'll merge this as-is for now, and the change to use a draft field can come later. Thanks!