Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挕 RFC: draft support for Markdown posts #440

Closed
1 of 3 tasks
FredKSchott opened this issue Jun 14, 2021 · 11 comments
Closed
1 of 3 tasks

馃挕 RFC: draft support for Markdown posts #440

FredKSchott opened this issue Jun 14, 2021 · 11 comments

Comments

@FredKSchott
Copy link
Member

FredKSchott commented Jun 14, 2021

What is Missing from Astro Today?

Proposed Solution

Implement this to match Jekyll.

As a stretch goal, we could also add the published: true/false syntax instead. This is similar, but draft=true can still be built if --drafts is used when you build. published=false will never make it into your build, no matter what.

Help Make it Happen!

  • I am willing to submit a PR to implement this change.
  • I am willing to submit a PR to implement this change, but would need some guidance.
  • I am not willing to submit a PR to implement this change.
@FredKSchott FredKSchott added this to Feature Request in 馃悰 Bug Tracker Jun 15, 2021
@ewatch
Copy link
Contributor

ewatch commented Jun 18, 2021

Analysis

  • This would mean markdown need to respect the format YEAR-MONTH-DAY-title.md to be not treated as drafts
  • adding a command-line parameter --drafts where drafts would be used in dev and build mode
    • in that case modification time of the file would be used as publish date

If there's no pressure behind this I'd like to give this a try.

@FredKSchott
Copy link
Member Author

@ewatch would love your help on this!

This would mean markdown need to respect the format YEAR-MONTH-DAY-title.md to be not treated as drafts

Not sure I follow, why wouldn't this work with a title.md file?

@ewatch
Copy link
Contributor

ewatch commented Jun 20, 2021

@FredKSchott
From what I've read in Jekyll there is no published: true / false frontmatter attribute.
So by default every file that has not a date in the filename through this convention mentioned above the file is treated as a draft. That's my understanding.
So then it the logic could be:

  • date in a file => will be published
  • published: true in frontmatter => will be published
  • rest of the files would be treated as drafts

Additionally Jekyll has a hard convention that only markdown files in the _drafts folder a previewable.

@ewatch
Copy link
Contributor

ewatch commented Jun 20, 2021

As a note:
The file / directory (pattern: YEAR-MONTH-DAY-title.md / directory _drafts) based approach has the benefit that within astro we could earlier decide about those files to filter them out, while when using the published: true / false the the filtering has to be done late after parsing the file and at least the frontmatter part.

@FredKSchott
Copy link
Member Author

From what I've read in Jekyll there is no published: true / false frontmatter attribute.

See here: https://jekyllrb.com/docs/front-matter/

every file that has not a date

I don't think we're ready to change the filename format just yet. Because we're following file-path routing, the file path matches the final URL so we couldn't force every URL to have a date.

@ewatch
Copy link
Contributor

ewatch commented Jun 21, 2021

Okay thanks. 馃憤
I will start implementing it with publish and draft attribute and create a PR.
Didn't think of the routing regarding the file pattern.

@ewatch
Copy link
Contributor

ewatch commented Jun 21, 2021

@FredKSchott
I implemented a first version and will add tests now.
Are you sure that buildOptions.draft: true should make astro ignoring the files instead of false ? 馃槗
Or should we name it ignoreDrafts ?

@tony-navillus
Copy link
Contributor

For what it's worth, many CMS's I've used stick with calling it preview when draft updates are used.

What about buildOptions.preview: true to include draft files?

@FredKSchott
Copy link
Member Author

  • @ewatch buildOptions.draft: true can't this include drafts, and then have it default to false / default to ignoring drafts in the final build?
  • Astro.fetchContent() - I think that this should respect the config value, and not return drafts unless buildOptions.draft is true
  • @tony-navillus I have a slight preference for draft over preview since it's more explicit. I always thought that "preview" referred to letting a headless CMS frontend update for live preview while you're editing content

@FredKSchott FredKSchott changed the title [Feature Request] draft support for Markdown posts 馃挕 RFC: draft support for Markdown posts Jun 30, 2021
@natemoo-re natemoo-re moved this from Needs Discussion to Accepted in 馃挕 RFC Tracker [No Longer Used] Jul 14, 2021
@jonathantneal
Copy link
Contributor

Hey everyone! This RFC is still accepted, and it has been moved to https://github.com/withastro/rfcs/blob/main/active-rfcs/support-draft-markdown-posts.md

In an effort to improve our RFC process, we made some changes to better organize things, which include a dedicated RFC repository.

馃挕 RFC Tracker [No Longer Used] automation moved this from Accepted to Abandoned (used old RFC template) Dec 3, 2021
@myakura
Copy link
Contributor

myakura commented Jan 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
馃挕 RFC Tracker [No Longer Used]
Abandoned (used old RFC template)
Development

Successfully merging a pull request may close this issue.

5 participants