Skip to content

How to update the frontmatter to add a complete date in frontmatter in a finished? #1242

Answered by Zachatoo
francisHugo asked this question in Help
Discussion options

You must be logged in to vote

The syntax error is because of this section.

if (noteStatus === "in progress") {
  frontmatter["noteStatus"] = "in progress";
} else (noteStatus === "done") {
  frontmatter["noteStatus"] = "done";
}

If you're using else, you cannot add a condition after it in parenthesis. You have to use else if instead.

if (noteStatus === "in progress") {
  frontmatter["noteStatus"] = "in progress";
} else if (noteStatus === "done") {
  frontmatter["noteStatus"] = "done";
}

Or just else, without a condition.

if (noteStatus === "in progress") {
  frontmatter["noteStatus"] = "in progress";
} else {
  frontmatter["noteStatus"] = "done";
}

Relevant docs.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@Zachatoo
Comment options

Zachatoo Dec 2, 2023
Collaborator

@Zachatoo
Comment options

Zachatoo Dec 2, 2023
Collaborator

@francisHugo
Comment options

@Zachatoo
Comment options

Zachatoo Dec 4, 2023
Collaborator

Answer selected by francisHugo
@francisHugo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants