summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/hugo.go3
-rw-r--r--commands/new.go4
-rw-r--r--create/content.go2
-rw-r--r--docs/content/overview/configuration.md3
-rw-r--r--helpers/path.go2
-rw-r--r--hugolib/site.go2
6 files changed, 9 insertions, 7 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 1f86baa2b..ff10ddde6 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -210,6 +210,7 @@ func LoadDefaultSettings() {
viper.SetDefault("ArchetypeDir", "archetypes")
viper.SetDefault("PublishDir", "public")
viper.SetDefault("DataDir", "data")
+ viper.SetDefault("ThemesDir", "themes")
viper.SetDefault("DefaultLayout", "post")
viper.SetDefault("BuildDrafts", false)
viper.SetDefault("BuildFuture", false)
@@ -514,7 +515,7 @@ func getDirList() []string {
filepath.Walk(helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
filepath.Walk(helpers.AbsPathify(viper.GetString("StaticDir")), walker)
if helpers.ThemeSet() {
- filepath.Walk(helpers.AbsPathify("themes/"+viper.GetString("theme")), walker)
+ filepath.Walk(helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), walker)
}
return a
diff --git a/commands/new.go b/commands/new.go
index a30c9f55b..8c2e4850f 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -176,8 +176,8 @@ func NewTheme(cmd *cobra.Command, args []string) error {
return newUserError("theme name needs to be provided")
}
- createpath := helpers.AbsPathify(filepath.Join("themes", args[0]))
- jww.INFO.Println("Creating theme at", createpath)
+ createpath := helpers.AbsPathify(filepath.Join(viper.GetString("themesDir"), args[0]))
+ jww.INFO.Println("creating theme at", createpath)
if x, _ := helpers.Exists(createpath, hugofs.SourceFs); x {
return newUserError(createpath, "already exists")
diff --git a/create/content.go b/create/content.go
index 3607e0139..6d38bbde1 100644
--- a/create/content.go
+++ b/create/content.go
@@ -132,7 +132,7 @@ func FindArchetype(kind string) (outpath string) {
search := []string{helpers.AbsPathify(viper.GetString("archetypeDir"))}
if viper.GetString("theme") != "" {
- themeDir := filepath.Join(helpers.AbsPathify("themes/"+viper.GetString("theme")), "/archetypes/")
+ themeDir := filepath.Join(helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), "/archetypes/")
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
jww.ERROR.Println("Unable to find archetypes directory for theme :", viper.GetString("theme"), "in", themeDir)
} else {
diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md
index 7047eb550..70df35dfc 100644
--- a/docs/content/overview/configuration.md
+++ b/docs/content/overview/configuration.md
@@ -130,7 +130,8 @@ Following is a list of Hugo-defined variables that you can configure and their c
staticdir: "static"
# display memory and timing of different steps of the program
stepAnalysis: false
- # theme to use (located in /themes/THEMENAME/)
+ # theme to use (located by default in /themes/THEMENAME/)
+ themesdir = "themes"
theme: ""
title: ""
# if true, use /filename.html instead of /filename/
diff --git a/helpers/path.go b/helpers/path.go
index bab6c71f9..0fce5690f 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -142,7 +142,7 @@ func GetStaticDirPath() string {
// If there is no theme, returns the empty string.
func GetThemeDir() string {
if ThemeSet() {
- return AbsPathify(filepath.Join("themes", viper.GetString("theme")))
+ return AbsPathify(filepath.Join(viper.GetString("themesDir"), viper.GetString("theme")))
}
return ""
}
diff --git a/hugolib/site.go b/hugolib/site.go
index aedba14ce..6a6760dba 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -495,7 +495,7 @@ func (s *Site) absDataDir() string {
}
func (s *Site) absThemeDir() string {
- return helpers.AbsPathify("themes/" + viper.GetString("theme"))
+ return helpers.AbsPathify(viper.GetString("themesDir") + "/" + viper.GetString("theme"))
}
func (s *Site) absLayoutDir() string {