diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-06-18 10:27:27 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-06-18 10:55:00 +0200 |
commit | 93aad3c543828efca2adeb7f96cf50ae29878593 (patch) | |
tree | 6a3dd4f6f878f8f36be9cef03a15b78b19d1f3da /create | |
parent | 5af045ebab109d3e5501b8b6d9fd448840c96c9a (diff) | |
download | hugo-93aad3c543828efca2adeb7f96cf50ae29878593.tar.gz hugo-93aad3c543828efca2adeb7f96cf50ae29878593.zip |
Split out the puthe path/filepath functions into common/paths
So they can be used from the config package without cyclic troubles.
Updates #8654
Diffstat (limited to 'create')
-rw-r--r-- | create/content.go | 4 | ||||
-rw-r--r-- | create/content_template_handler.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/create/content.go b/create/content.go index 26eda2031..797ffe758 100644 --- a/create/content.go +++ b/create/content.go @@ -21,6 +21,8 @@ import ( "path/filepath" "strings" + "github.com/gohugoio/hugo/common/paths" + "github.com/pkg/errors" "github.com/gohugoio/hugo/common/hexec" @@ -39,7 +41,7 @@ import ( func NewContent( sites *hugolib.HugoSites, kind, targetPath string) error { targetPath = filepath.Clean(targetPath) - ext := helpers.Ext(targetPath) + ext := paths.Ext(targetPath) ps := sites.PathSpec archetypeFs := ps.BaseFs.SourceFilesystems.Archetypes.Fs sourceFs := ps.Fs.Source diff --git a/create/content_template_handler.go b/create/content_template_handler.go index 3e9701e4b..09cf4c0a5 100644 --- a/create/content_template_handler.go +++ b/create/content_template_handler.go @@ -20,6 +20,8 @@ import ( "strings" "time" + "github.com/gohugoio/hugo/common/paths" + "github.com/pkg/errors" "github.com/gohugoio/hugo/helpers" @@ -129,7 +131,7 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, name, kind, targetPath, archety // Reuse the Hugo template setup to get the template funcs properly set up. templateHandler := s.Deps.Tmpl().(tpl.TemplateManager) - templateName := helpers.Filename(archetypeFilename) + templateName := paths.Filename(archetypeFilename) if err := templateHandler.AddTemplate("_text/"+templateName, string(archetypeTemplate)); err != nil { return nil, errors.Wrapf(err, "Failed to parse archetype file %q:", archetypeFilename) } |