Split out the puthe path/filepath functions into common/paths

So they can be used from the config package without cyclic troubles.

Updates #8654
This commit is contained in:
Bjørn Erik Pedersen
2021-06-18 10:27:27 +02:00
parent 5af045ebab
commit 93aad3c543
21 changed files with 956 additions and 591 deletions

View File

@@ -17,6 +17,8 @@ import (
"strings"
"time"
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/resources/resource"
@@ -118,7 +120,7 @@ func (f FrontMatterHandler) IsDateKey(key string) bool {
// This follows the format as outlined in Jekyll, https://jekyllrb.com/docs/posts/:
// "Where YEAR is a four-digit number, MONTH and DAY are both two-digit numbers"
func dateAndSlugFromBaseFilename(name string) (time.Time, string) {
withoutExt, _ := helpers.FileAndExt(name)
withoutExt, _ := paths.FileAndExt(name)
if len(withoutExt) < 10 {
// This can not be a date.