Excluding files isn't working

ERROR the “date” front matter field is not a parsable date: see C:\Mine\Code\quickstart\content\posts\Templates\Draft.md

hugo.toml

[module]
  [[module.mounts]]
    source = 'content'
    target = 'content'
  [[module.mounts]]
    source = 'static'
    target = 'static'
  [[module.mounts]]
    source = 'layouts'
    target = 'layouts'
  [[module.mounts]]
    source = 'content'
    target = 'content'
    files = ['posts/Templates/*']

I tried a bunch of varieties of this but they just don’t work no matter what I do. It shouldn’t be giving that error I think because it shouldn’t even be seeing the template folder.

You mounted content twice, one with a filter and one without. Do this instead:

[module]
  [[module.mounts]]
    source = 'content'
    target = 'content'
    files  = ['! /posts/Templates/*']
  [[module.mounts]]
    source = 'static'
    target = 'static'
  [[module.mounts]]
    source = 'layouts'
    target = 'layouts'

The files parameter isn’t an exclusion list. See docs:
https://gohugo.io/configuration/module/#files

Also, save yourself some trouble… use lowercase for file and directory names, replacing spaces with hyphens.

content/My Section/My First Article.md   <-- NO
content/my-section/my-first-article.md   <-- YES

Windows doesn’t care, but your webserver will.

Thank you so much for the help, I really appreciate it

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.