Module.mounts files question

I have subdirs under config/_default, layouts tree named ex. .save and .org

Those dirs include test version, working copy before edit, …

How I have to setup hugo.toml in the new files rules so that Hugo skip those dirs = not read those dirs.

I have tried:

[module]
  [[module.mounts]]
    source = 'content'
    target = 'content'
[[module.mounts]]
    source = 'layouts'
    target = 'layouts'
...

# all has line - try to exclude dirs:
files = ['! */.save/*', '! */.org/*','! .save/* ]

But Hugo use those dirs …

  • I like to exclude all .save and .org dirs under my site source dir.

mmh, on latest hugo 0.159 extended

  • config is not listed in Components
    I doubt you can mount that.

  • content - ignores dot files and folders per se
    I cannot reproduce that one - the .save folder is not rendered

  • layouts works fine for me
    the first ignores the one at the base, the two ** all down the tree

    [[module.mounts]]
      source = "layouts"
      target = "layouts"
      files = [ '! .save', '! **/.save']
    

maybe I missed things, but then a reproducable repo would help…

I think @irkode cut to the point and that it’s about single vs double asterisk. But as **` matches everything (including slash delimiters), I think you can simplify it with something ala:

files = ['! **.{save,org}**"]

if that ex. includes hello.save the pattern for folders would be something like ! **/*.save/**

@bep 's pattern would match all where a .save or .org is somewhere in the path. example a.save_it

that said: the exact pattern depends on the exact requirement.

These versions work fine. Go ahead and block the contents of those directories.

[module]
 [[module.mounts]]
    source = 'layouts'
    target = 'layouts'
    files = ['! **/.save', '! **/.org' ] 
    # or
    files = ['! **/{.save,.org}']

Generally speaking, it’d be nice if the Hugo documentation had more detailed examples.

It’d also be great if hugo --logLevel debug showed the filenames in the output.
It would make it much easier to figure out which file is causing each message.
I couldn’t find a way to see the filenames other than going through them one by one
with --panicOnWarning.