diff --git a/commands/hugo.go b/commands/hugo.go
index 7afd78a9d43..0f7701e661f 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -209,7 +209,7 @@ func initHugoBuilderFlags(cmd *cobra.Command) {
}
func initRootPersistentFlags() {
- HugoCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is path/config.yaml|json|toml)")
+ HugoCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is path/config.yml|json|toml)")
// Set bash-completion
validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"}
diff --git a/commands/import_jekyll.go b/commands/import_jekyll.go
index 20356f1e166..88125d3b89a 100644
--- a/commands/import_jekyll.go
+++ b/commands/import_jekyll.go
@@ -193,7 +193,7 @@ func loadJekyllConfig(jekyllRoot string) map[string]interface{} {
exists, err := helpers.Exists(path, fs)
if err != nil || !exists {
- jww.WARN.Println("_config.yaml not found: Is the specified Jekyll root correct?")
+ jww.WARN.Println("_config.yml not found: Is the specified Jekyll root correct?")
return nil
}
@@ -245,18 +245,8 @@ func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]
"languageCode": "en-us",
"disablePathToLower": true,
}
- kind = parser.FormatSanitize(kind)
-
- by, err := parser.InterfaceToConfig(in, parser.FormatToLeadRune(kind))
- if err != nil {
- return err
- }
-
- err = helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), bytes.NewReader(by), hugofs.Source())
- if err != nil {
- return
- }
+ createConfig(inpath, kind, in)
return nil
}
diff --git a/commands/new.go b/commands/new.go
index fe4ed75e17c..35750adc2b2 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -135,7 +135,7 @@ func doNewSite(basepath string, force bool) error {
return errors.New(basepath + " already exists and is not empty")
case !isEmpty && force:
- all := append(dirs, filepath.Join(basepath, "config."+configFormat))
+ all := append(dirs, filepath.Join(basepath, parser.ConfigBasename(configFormat)))
for _, path := range all {
if exists, _ := helpers.Exists(path, hugofs.Source()); exists {
return errors.New(path + " already exists")
@@ -148,7 +148,12 @@ func doNewSite(basepath string, force bool) error {
hugofs.Source().MkdirAll(dir, 0777)
}
- createConfig(basepath, configFormat)
+ in := map[string]interface{}{
+ "baseurl": "http://replace-this-with-your-hugo-site.com/",
+ "title": "My New Hugo Site",
+ "languageCode": "en-us",
+ }
+ createConfig(basepath, configFormat, in)
jww.FEEDBACK.Printf("Congratulations! Your new Hugo site is created in %q.\n\n", basepath)
jww.FEEDBACK.Println(`Just a few more steps and you're ready to go:
@@ -316,12 +321,7 @@ func newContentPathSection(path string) (string, string) {
return createpath, section
}
-func createConfig(inpath string, kind string) (err error) {
- in := map[string]string{
- "baseurl": "http://replace-this-with-your-hugo-site.com/",
- "title": "My New Hugo Site",
- "languageCode": "en-us",
- }
+func createConfig(inpath string, kind string, in map[string]interface{}) (err error) {
kind = parser.FormatSanitize(kind)
by, err := parser.InterfaceToConfig(in, parser.FormatToLeadRune(kind))
@@ -329,7 +329,7 @@ func createConfig(inpath string, kind string) (err error) {
return err
}
- err = helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), bytes.NewReader(by), hugofs.Source())
+ err = helpers.WriteToDisk(filepath.Join(inpath, parser.ConfigBasename(kind)), bytes.NewReader(by), hugofs.Source())
if err != nil {
return
}
diff --git a/commands/new_test.go b/commands/new_test.go
index 5991e181393..27494e6c12c 100644
--- a/commands/new_test.go
+++ b/commands/new_test.go
@@ -19,6 +19,7 @@ import (
"testing"
"github.com/spf13/hugo/hugofs"
+ "github.com/spf13/hugo/parser"
"github.com/stretchr/testify/assert"
)
@@ -100,3 +101,24 @@ func TestDoNewSite_error_force_config_inside_exists(t *testing.T) {
err := doNewSite(basepath, true)
assert.NotNil(t, err)
}
+
+func TestDoNewSite_basename_func_called(t *testing.T) {
+ var configBasenameSave = parser.ConfigBasename
+ actual_count := 0
+ parser.ConfigBasename = func(string) string {
+ actual_count++
+ return "anything"
+ }
+ basepath := filepath.Join(os.TempDir(), "blog")
+ hugofs.InitMemFs()
+
+ hugofs.Source().MkdirAll(basepath, 777)
+ doNewSite(basepath, true)
+
+ hugofs.Source().RemoveAll(basepath)
+ doNewSite(basepath, false)
+
+ expected_count := 2
+ assert.Equal(t, expected_count, actual_count)
+ parser.ConfigBasename = configBasenameSave
+}
diff --git a/docs/content/extras/analytics.md b/docs/content/extras/analytics.md
index 112671df535..059c6337ff6 100644
--- a/docs/content/extras/analytics.md
+++ b/docs/content/extras/analytics.md
@@ -14,7 +14,7 @@ Hugo ships with prebuilt internal templates for Google Analytics tracking, inclu
## Configuring Google Analytics
-Provide your tracking id in your configuration file, e.g. config.yaml.
+Provide your tracking id in your configuration file, e.g. config.yml.
googleAnalytics = "UA-123-45"
diff --git a/docs/content/extras/comments.md b/docs/content/extras/comments.md
index 0dabd1c31ec..1164ba4237b 100644
--- a/docs/content/extras/comments.md
+++ b/docs/content/extras/comments.md
@@ -27,7 +27,7 @@ Hugo comes with all the code you would need to include load Disqus. Simply inclu
## Configuring Disqus
-That template requires you to set a single value in your site config file, e.g. config.yaml.
+That template requires you to set a single value in your site config file, e.g. config.yml.
disqusShortname = "XYW"
diff --git a/docs/content/extras/highlighting.md b/docs/content/extras/highlighting.md
index 1efa9a0dcdd..d79bd4aaf9c 100644
--- a/docs/content/extras/highlighting.md
+++ b/docs/content/extras/highlighting.md
@@ -32,7 +32,7 @@ If you have never worked with Pygments before, here is a brief primer:
On Debian and Ubuntu systems, you may also install Pygments by running `sudo apt-get install python3-pygments`.
-Hugo gives you two options that you can set with the variable `pygmentsuseclasses` (default `false`) in `config.toml` (or `config.yaml`).
+Hugo gives you two options that you can set with the variable `pygmentsuseclasses` (default `false`) in `config.toml` (or `config.yml`).
1. Color-codes for highlighting keywords are directly inserted if `pygmentsuseclasses = false` (default). See in the example below. The color-codes depend on your choice of the `pygmentsstyle` (default `"monokai"`). You can explore the different color styles on [pygments.org](http://pygments.org/) after inserting some example code.
2. If you choose `pygmentsuseclasses = true`, Hugo includes class names in your code instead of color-codes. For class-names to be meaningful, you need to include a `.css`-file in your website representing your color-scheme. You can either generate this `.css`-files according to this [description](http://pygments.org/docs/cmdline/) or download the standard ones from the [GitHub pygments-css repository](https://github.com/richleland/pygments-css).
diff --git a/docs/content/extras/menus.md b/docs/content/extras/menus.md
index 754b588415d..6ab5f9f63a7 100644
--- a/docs/content/extras/menus.md
+++ b/docs/content/extras/menus.md
@@ -108,7 +108,7 @@ Here’s an example `config.toml`:
weight = -100
url = "/getting-started/"
-And the equivalent example `config.yaml`:
+And the equivalent example `config.yml`:
---
menu:
diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md
index 8127c5823ce..93dc3f6d4f6 100644
--- a/docs/content/overview/configuration.md
+++ b/docs/content/overview/configuration.md
@@ -20,7 +20,7 @@ websites since the defaults follow commonly used patterns.
Hugo expects to find the config file in the root of the source directory and
will look there first for a `config.toml` file. If none is present, it will
-then look for a `config.yaml` file, followed by a `config.json` file.
+then look for a `config.yml` file, followed by a `config.json` file.
The config file is a site-wide config. The config file provides directions to
hugo on how to build the site as well as site-wide parameters and menus.
@@ -33,13 +33,13 @@ env HUGO_TITLE="Some Title" hugo
## Examples
-The following is an example of a typical yaml config file:
+The following is an example of a typical YAML config file:
---
baseurl: "http://yoursite.example.com/"
...
-The following is an example of a toml config file with some of the default values.
+The following is an example of a TOML config file with some of the default values.
Values under `[params]` will populate the `.Site.Params` variable for use in templates:
contentdir = "content"
@@ -57,7 +57,7 @@ Values under `[params]` will populate the `.Site.Params` variable for use in tem
description = "Tesla's Awesome Hugo Site"
author = "Nikola Tesla"
-Here is a yaml configuration file which sets a few more options:
+Here is a YAML configuration file which sets a few more options:
---
baseurl: "http://yoursite.example.com/"
@@ -92,7 +92,7 @@ Following is a list of Hugo-defined variables that you can configure and their c
# enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
relativeURLs: false
canonifyURLs: false
- # config file (default is path/config.yaml|json|toml)
+ # config file (default is path/config.yml|json|toml)
config: "config.toml"
contentdir: "content"
dataDir: "data"
diff --git a/docs/content/overview/usage.md b/docs/content/overview/usage.md
index feb1b0f7636..edafbd6c1cf 100644
--- a/docs/content/overview/usage.md
+++ b/docs/content/overview/usage.md
@@ -42,7 +42,7 @@ Flags:
-D, --buildDrafts=false: include content marked as draft
-F, --buildFuture=false: include content with publishdate in the future
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
- --config="": config file (default is path/config.yaml|json|toml)
+ --config="": config file (default is path/config.yml|json|toml)
-d, --destination="": filesystem path to write files to
--disableRSS=false: Do not build RSS files
--disableSitemap=false: Do not build Sitemap file
diff --git a/docs/content/taxonomies/usage.md b/docs/content/taxonomies/usage.md
index b206f9c74c7..07c5d16c925 100644
--- a/docs/content/taxonomies/usage.md
+++ b/docs/content/taxonomies/usage.md
@@ -26,7 +26,7 @@ or singular key: "plural value"
config.toml excerpt: | config.yaml excerpt: | +config.toml excerpt: | config.yml excerpt: |
---|