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

match doesn't seem to work on directories with names starting with . #1055

Closed
vaibhavsagar opened this issue Nov 24, 2024 · 7 comments
Closed

Comments

@vaibhavsagar
Copy link
Contributor

I'm trying to verify my domain for Bluesky, which involves creating a file at <domain>/.well-known/atproto-did. Unfortunately it seems like Hakyll doesn't match correctly on directories starting with .. For example, I would expect code like this:

    match "extra/**" $ do
        route idRoute
        compile copyFileCompiler

To work on files at both extra/regular/foo and extra/.dotted/bar, but it only seems to match on the former while ignoring the latter. I have a small reproducer here. Is this a Hakyll bug or am I doing something wrong?

@chungyc
Copy link
Contributor

chungyc commented Nov 24, 2024

If you want to match on files or directories starting with a dot, you have to tell Hakyll not to ignore them.

See:

@vaibhavsagar
Copy link
Contributor Author

Thanks for pointing that out! I'm not sure that's what's happening here though:

ghci> import Hakyll
ghci> shouldIgnoreFile defaultConfiguration "extras/.well-known/atproto-did"
False
ghci> shouldIgnoreFile defaultConfiguration ".well-known/atproto-did"
False

@vaibhavsagar
Copy link
Contributor Author

Okay, I updated my configuration with e.g. ignoreFile = const False to test this out and indeed that worked. I'm still confused why shouldIgnoreFile is giving me an inconsistent result but that's a separate issue.

@chungyc
Copy link
Contributor

chungyc commented Nov 24, 2024

It checks the name of the file, not the entire path. For example:

λ import Hakyll
λ shouldIgnoreFile defaultConfiguration ".extras"
True
λ shouldIgnoreFile defaultConfiguration ".well-known"
True
λ shouldIgnoreFile defaultConfiguration "well-known/.false"
True
λ shouldIgnoreFile defaultConfiguration ".well-known/false"
False

@vaibhavsagar
Copy link
Contributor Author

I see, thanks for clarifying!

@jaspervdj
Copy link
Owner

FWIW I like saving these files without the . in the source of the website so they show up using ls and similar. I then route these to files starting with ..

@vaibhavsagar
Copy link
Contributor Author

Thanks, that's what I ended up doing too!

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

No branches or pull requests

3 participants