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

Nested directory globs with ignored_content #1701

Closed
austinbutler opened this issue Dec 21, 2021 · 7 comments
Closed

Nested directory globs with ignored_content #1701

austinbutler opened this issue Dec 21, 2021 · 7 comments

Comments

@austinbutler
Copy link

What I'd like to do is have this work: ignored_content = ["albums/**/*.{jpg,jpeg,png}"]. Basically ignore any images in content/albums and all sub-folders of that. This does not work.

ignored_content = ["*.{jpg,jpeg,png}"] works, but it ignores all images in content basically.

I think #481 says this should work, but it may just be referring to specifying a particular folder.

I'm using v0.15.2.

@Keats
Copy link
Collaborator

Keats commented Dec 21, 2021

Right now the ignored content only work on a file basis, it strips the path before checking the glob: https://github.com/getzola/zola/blob/master/components/library/src/content/mod.rs#L56-L64

ignored_content was added for tmp files by editors really, it could be extended to support that usecase though.

@kartva
Copy link
Contributor

kartva commented Jan 14, 2022

I also need ignored_content to ignore entire folders; I'd be happy to implement it.

Additionally, how about ignoring stuff from .gitignore (if it exists) as well? Might be a nice addition.

@Keats
Copy link
Collaborator

Keats commented Jan 15, 2022

Additionally, how about ignoring stuff from .gitignore (if it exists) as well?

Hmm not entirely sure how I feel about that. You'd need a config option to turn it off so I think I prefer to not do that.

@kartva
Copy link
Contributor

kartva commented Jan 16, 2022

Then adding in support for directory paths in ignored_content is a go? (we get globbing for free on Linux as well - though if you think that globbing support on Windows should also be a part of the PR, I did find a few crates for that purpose.)

@Keats
Copy link
Collaborator

Keats commented Jan 16, 2022

Yep it's fine to add, but it should work on every platforms. We're using globwalk somewhere else so it's probably good to use that.

@kartva
Copy link
Contributor

kartva commented Jan 17, 2022

Well, turns out we didn't even need globwalk - the globset crate has support for Unix path globbing, which includes subdirectory globbing and matching on directories.

@austinbutler
Copy link
Author

Haven't gotten around to testing it, but it looks like this was resolved by #1738 🙌 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants