diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-09-19 07:48:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-09-23 19:27:23 +0200 |
commit | 2650fa772b40846d9965f8c5f169286411f3beb2 (patch) | |
tree | 26d209ebea23611c146d851cb12827e793eaf6d5 /hugolib/fileInfo.go | |
parent | ef525b15d4584886b52428bd7a35de835ab07a48 (diff) |
Add directory based archetypes
Given this content:
```bash
archetypes
├── default.md
└── post-bundle
├── bio.md
├── images
│ └── featured.jpg
└── index.md
```
```bash
hugo new --kind post-bundle post/my-post
```
Will create a new folder in `/content/post/my-post` with the same set of files as in the `post-bundle` archetypes folder.
This commit also improves the archetype language detection, so, if you use template code in your content files, the `.Site` you get is for the correct language. This also means that it is now possible to translate strings defined in the `i18n` bundles, e.g. `{{ i18n "hello" }}`.
Fixes #4535
Diffstat (limited to 'hugolib/fileInfo.go')
-rw-r--r-- | hugolib/fileInfo.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hugolib/fileInfo.go b/hugolib/fileInfo.go index 90cf91377..e4af42fd3 100644 --- a/hugolib/fileInfo.go +++ b/hugolib/fileInfo.go @@ -61,7 +61,7 @@ func (fi *fileInfo) isOwner() bool { return fi.bundleTp > bundleNot } -func isContentFile(filename string) bool { +func IsContentFile(filename string) bool { return contentFileExtensionsSet[strings.TrimPrefix(helpers.Ext(filename), ".")] } @@ -98,7 +98,7 @@ const ( // Returns the given file's name's bundle type and whether it is a content // file or not. func classifyBundledFile(name string) (bundleDirType, bool) { - if !isContentFile(name) { + if !IsContentFile(name) { return bundleNot, false } if strings.HasPrefix(name, "_index.") { |