Repository: gohugoio/hugo (language: go)

Issue:
`hugo mod vendor` does not copy config directory to _vendor
Reading the documentation at https://gohugo.io/commands/hugo_mod_vendor/ I would assume that the process would copy over the configuration directory or file of the module too. 

Currently, it appears, only directories that are explicitly mounted in the module-configuration are vendored with the addition of a package.json if it exists. The problem is, that the config directory can't be mounted and might contain information used in layouts or the module later on.

Is this by design or a bug?


Discussion / hints:
I am unable to reproduce the problem as described.

```bash
git clone --single-branch -b hugo-github-issue-9751 https://github.com/jmooring/hugo-testing hugo-github-issue-9751
cd hugo-github-issue-9751
hugo 
hugo mod vendor
tree _vendor
```

config.toml is present in the _vendor directory.
Please try adding the module https://github.com/dnb-org/dnb-hugo-giscus which has the configuration in a config directory. Running `hugo mod vendor` on a project using this module does not add the config directory. This might be related to config in the config directory only, as I don't have any module using config.toml currently...
Sample:

Before: 
https://github.com/davidsneighbour/kollitsch.de/tree/39772071c929233b9d373533e7c7d9bcabb0fead
After `hugo mod vendor`:
https://github.com/davidsneighbour/kollitsch.de/tree/test/vendoring

Fix patch:
diff --git a/modules/client.go b/modules/client.go
index eab871d01b0..6e1cfe881c3 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -282,6 +282,15 @@ func (c *Client) Vendor() error {
 			}
 		}
 
+		// Include the config directory if present.
+		configDir := filepath.Join(dir, "config")
+		_, err = c.fs.Stat(configDir)
+		if err == nil {
+			if err := hugio.CopyDir(c.fs, configDir, filepath.Join(vendorDir, t.Path(), "config"), nil); err != nil {
+				return errors.Wrap(err, "failed to copy config dir to vendor dir")
+			}
+		}
+
 		// Also include any theme.toml or config.* files in the root.
 		configFiles, _ := afero.Glob(c.fs, filepath.Join(dir, "config.*"))
 		configFiles = append(configFiles, filepath.Join(dir, "theme.toml"))


Test patch: