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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontmatter - setting "draft" to "first" #285

Open
hellquist opened this issue Mar 16, 2024 · 3 comments
Open

Frontmatter - setting "draft" to "first" #285

hellquist opened this issue Mar 16, 2024 · 3 comments
Labels
awaiting reply Waiting for a response from the author to proceed

Comments

@hellquist
Copy link

Hi! Thanks for an awesome theme! Really cool.

I'm running the latest version. When I'm reading the docs regarding setting modDatetime it says I should set draft: in my frontmatter to draft: first, and that it will trigger the magic

if [ "$draft" = "first" ]; then

However, when I do that I get this error message

image

Am I missing a step somewhere? Draft is defined as a boolean (i.e. true/false) and anything else will generate that schema error.

I have literally copied/pasted the suggested commands on that page, and everything else with the theme in general seems to be working perfectly fine, so I'm guessing this could be user error on my part, I'm just not sure what part I might have missed.

The one thing I have assumed is a typo I haven't done though, on your blog post/doc it says:

Navigating to the hooks/pre-commit file, we are going to add one or both of the following snippets. I have assumed you mean .husky/pre-commit, as that was the file in the previous instruction. That file btw did have some content before adding snippet from your blog post:

    1 #!/usr/bin/env sh
    2 . "$(dirname -- "$0")/_/husky.sh"
    3
    4 npx lint-staged

I have pasted your snippets after that...is that correct?

@satnaing
Copy link
Owner

satnaing commented Aug 3, 2024

Hello @hellquist
Sorry for the late reply.
Have you resolved the issue? Please let me know.

@satnaing
Copy link
Owner

satnaing commented Aug 3, 2024

I'm not 100% sure if this is the case.
But by looking at the screenshot error you provided, it's likely to be the problem in ContentCollection validation.

---
author: Sat Naing
# others
draft: "false" # instead of (draft: false)
# others
---

@satnaing satnaing added the awaiting reply Waiting for a response from the author to proceed label Aug 4, 2024
@SSmale
Copy link
Contributor

SSmale commented Sep 28, 2024

Hey @hellquist, the draft: first is used to set the date times using the git hook, this should be done after you have written it and are wanting it to go live.

The flow should be:

  1. Set the draft to true
  2. Write the content, it can be checked in during this time and will not be visible.
  3. you are happy with the post and are wanting it to go live, you now stop the server and set draft to first
  4. Check in the change
  5. Magic time
    ———————————————

The magic

  1. the hook will see that the post is marked as first and will clear the modDateTime field and set the pubDateTime to now
  2. It will then set the draft flag to false
  3. Then is then pushed to the repo and when the project is built your post will be visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reply Waiting for a response from the author to proceed
Projects
None yet
Development

No branches or pull requests

3 participants