HiDeoo / starlight-blog

Starlight plugin to add a blog to your documentation
https://starlight-blog-docs.vercel.app
MIT License
106 stars 10 forks source link

Frontmatter to flag as draft/unpublished #17

Closed brettstack closed 1 month ago

brettstack commented 6 months ago

Is your feature request related to a problem?

Hey @HiDeoo, huge fan of what you've made. It would be great if we could mark posts that aren't yet ready to be published.

Describe the solution you'd like

One of these new frontmatter propeties:

draft: true
isDraft: true
published: false (default: true)
isPublished: false (default: true)

Then when you're ready to publish, simply remove that line.

Describe alternatives you've considered

Alternatively, a _drafts directory. Then when you're ready to publish, simply drag+drop into the main folder.

Additional Context

No response

HiDeoo commented 6 months ago

Thanks a lot 🙌

This sounds like a great idea, makes total sense. This should also goes well with Starlight new feature to extend content collection schemas released in v0.14.0.

The next release main priority will be to add support for Starlight > v0.13.1 but I think this should be fairly easy to add that too.

I'll update this issue with any progress.

brettstack commented 6 months ago

Legend!

brettstack commented 4 months ago

Hey @HiDeoo any update? 🙏

HiDeoo commented 3 months ago

Sorry for the delayed response.

I'm planning to address this in Starlight directly with https://github.com/withastro/starlight/discussions/990 and I'm hoping to submit a PR for this in the next few days.

brettstack commented 3 months ago

Thanks! "visible during development and maybe with a notice at the top like fallback content" this is perfect!

HiDeoo commented 2 months ago

Forgot to update this issue, but the PR is available at https://github.com/withastro/starlight/pull/1613.

Once this is released, we should be able to update the package to support this new feature.

HiDeoo commented 1 month ago

New update: draft pages support has been released in Starlight 0.22.0. This still requires some changes in the plugin itself to properly support drafts in the blog.

I'll wait for 0.22.1 as 0.22.0 contains an issue with custom pages used by this plugin but I already submitted a patch PR to fix the issue. Starlight 0.22.1 has been released with the fix, so I'll be able to start working on this relatively soon.

HiDeoo commented 1 month ago

Version 0.7.0 finally includes support for draft blog posts :tada: Thanks for your patience.

It's built on top of the equivalent Starlight feature so adding draft: true to a blog post frontmatter will make it a draft.

In production builds, draft blog posts are not generateed, are excluded from the blog post list and tag pages.

During development, draft blog posts are visible and a small "Draft" badge is displayed in blog post previews:

SCR-20240502-ouic