mirror of
https://github.com/danog/gojekyll.git
synced 2025-01-22 20:41:13 +01:00
Steps towards Windows compat
This commit is contained in:
parent
8a8767e569
commit
8223c9b7d8
@ -56,7 +56,7 @@ func (c *Collection) IsPosts() bool {
|
||||
|
||||
// PathPrefix returns the collection's directory prefix, e.g. "_posts/"
|
||||
func (c *Collection) PathPrefix() string {
|
||||
return "_" + c.Name + "/"
|
||||
return filepath.FromSlash("_" + c.Name + "/")
|
||||
}
|
||||
|
||||
// Source returns the source directory for pages in the collection.
|
||||
|
9
page.go
9
page.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@ -85,13 +86,13 @@ func (p *StaticPage) Write(w io.Writer) error {
|
||||
// See https://jekyllrb.com/docs/variables/#page-variables
|
||||
func (p *pageFields) TemplateObject() VariableMap {
|
||||
var (
|
||||
relpath = "/" + p.relpath
|
||||
base = filepath.Base(relpath)
|
||||
ext = filepath.Ext(relpath)
|
||||
relpath = "/" + filepath.ToSlash(p.relpath)
|
||||
base = path.Base(relpath)
|
||||
ext = path.Ext(relpath)
|
||||
)
|
||||
|
||||
return VariableMap{
|
||||
"path": "/" + p.relpath,
|
||||
"path": relpath,
|
||||
"modified_time": 0, // TODO
|
||||
"name": base,
|
||||
"basename": helpers.PathWithoutExtension(base),
|
||||
|
@ -97,7 +97,7 @@ func (p *pageFields) expandPermalink() (s string, err error) {
|
||||
}
|
||||
return value
|
||||
})
|
||||
return path.Clean(s), nil
|
||||
return path.Clean(filepath.ToSlash(s)), nil
|
||||
}
|
||||
|
||||
// The permalink is computed once instead of on demand, so that subsequent
|
||||
|
Loading…
x
Reference in New Issue
Block a user