summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_sites.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-19 07:48:17 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-23 19:27:23 +0200
commit2650fa772b40846d9965f8c5f169286411f3beb2 (patch)
tree26d209ebea23611c146d851cb12827e793eaf6d5 /hugolib/hugo_sites.go
parentef525b15d4584886b52428bd7a35de835ab07a48 (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/hugo_sites.go')
-rw-r--r--hugolib/hugo_sites.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index 88715a86e..3ff31ece3 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -57,6 +57,14 @@ func (h *HugoSites) IsMultihost() bool {
return h != nil && h.multihost
}
+func (h *HugoSites) LanguageSet() map[string]bool {
+ set := make(map[string]bool)
+ for _, s := range h.Sites {
+ set[s.Language.Lang] = true
+ }
+ return set
+}
+
func (h *HugoSites) NumLogErrors() int {
if h == nil {
return 0