Skip to content

Commit

Permalink
prevent about from being published to nostr
Browse files Browse the repository at this point in the history
  • Loading branch information
pluja committed Sep 28, 2023
1 parent 45a6a4b commit 12d3379
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions blogo/articles.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ func LoadArticle(filepath string) (err error) {
if err != nil {
return err
}

// Publish to Nostr
err = PublishArticleToNostr(article)
if err != nil {
log.Err(err).Msg("Error publishing article to Nostr")
}

switch slug {
case "about":
About.Slug = "about"
Expand All @@ -161,6 +154,13 @@ func LoadArticle(filepath string) (err error) {
}
}

if article.NostrUrl == "" && article.Slug != "about" {
// Publish to Nostr
err = PublishArticleToNostr(article)
if err != nil {
log.Err(err).Msg("Error publishing article to Nostr")
}
}
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions blogo/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func InitNostr() error {

// Publishes the article to Nostr if enabled and not yet published
func PublishArticleToNostr(article ArticleData) error {
if article.Slug == "about" {
log.Info().Msg("Not publishing about page to Nostr")
return nil
}

if os.Getenv("PUBLISH_TO_NOSTR") == "false" {
log.Info().Msg("PUBLISH_TO_NOSTR is set to false. Not publishing...")
return nil
Expand Down

0 comments on commit 12d3379

Please sign in to comment.