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

Add whitelist mode #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

mro95
Copy link

@mro95 mro95 commented Jan 29, 2024

In this pull request, I've implemented a whitelist approach for publishing the notes.

This approach introduces an optional metadata keyword, publish, to the note. If publish: true is present in the metadata of the note, it will be included in the published site, otherwise it will be excluded. This option is useful for drafts, private notes, or content that isn't ready or appropriate for the public yet.

The new changes include:

  • Adding a whitelist_mode field in the VaultBuilder structure to represent this behavior.
  • Adding a new flag, whitelist_mode, to the Command enum (which will be enabled with the argument --whitelist-mode on the command line).
  • Adding a new method, get, on the Metadata structure.
  • Enhancing the note parsing loop in the VaultBuilder.build function to check each note's metadata for publish: true.

These changes don't affect the default behavior of obsidian-garden, only adding new functionality.

Copy link
Owner

@ecarrara ecarrara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mro95!

Do you mind adding a test case for this new flag --whitelist-mode?

src/vault.rs Outdated Show resolved Hide resolved
@ecarrara
Copy link
Owner

ecarrara commented Jan 30, 2024

You can use -t (or --tag) to publish notes with specific tag.

obsidian-garden -t public .   _build

But I agree, the tool should support the public: true/false property on front-matter section.

Co-authored-by: Erle Carrara <carrara.erle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants