mirror of
https://github.com/gohugoio/hugo.git
synced 2025-01-23 04:54:17 +00:00
parent
4ad39445ef
commit
342b6fe8a5
2 changed files with 10 additions and 6 deletions
|
@ -643,8 +643,8 @@ func TestCreateNewPage(t *testing.T) {
|
||||||
assertFunc := func(t *testing.T, ext string, pages Pages) {
|
assertFunc := func(t *testing.T, ext string, pages Pages) {
|
||||||
p := pages[0]
|
p := pages[0]
|
||||||
|
|
||||||
// issue #2290: No /content in Path
|
// issue #2290: Path is relative to the content dir and will continue to be so.
|
||||||
// require.Equal(t, "asdf", p.Path())
|
require.Equal(t, filepath.FromSlash(fmt.Sprintf("p0.%s", ext)), p.Path())
|
||||||
assert.False(t, p.IsHome)
|
assert.False(t, p.IsHome)
|
||||||
checkPageTitle(t, p, "Simple")
|
checkPageTitle(t, p, "Simple")
|
||||||
checkPageContent(t, p, normalizeExpected(ext, "<p>Simple Page</p>\n"))
|
checkPageContent(t, p, normalizeExpected(ext, "<p>Simple Page</p>\n"))
|
||||||
|
@ -654,7 +654,11 @@ func TestCreateNewPage(t *testing.T) {
|
||||||
checkTruncation(t, p, false, "simple short page")
|
checkTruncation(t, p, false, "simple short page")
|
||||||
}
|
}
|
||||||
|
|
||||||
testAllMarkdownEnginesForPages(t, assertFunc, nil, simplePage)
|
settings := map[string]interface{}{
|
||||||
|
"contentDir": "mycontent",
|
||||||
|
}
|
||||||
|
|
||||||
|
testAllMarkdownEnginesForPages(t, assertFunc, settings, simplePage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSplitSummaryAndContent(t *testing.T) {
|
func TestSplitSummaryAndContent(t *testing.T) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
// File represents a source content file.
|
// File represents a source content file.
|
||||||
// All paths are relative from the source directory base
|
// All paths are relative from the source directory base
|
||||||
type File struct {
|
type File struct {
|
||||||
relpath string // Original relative path, e.g. content/foo.txt
|
relpath string // Original relative path, e.g. section/foo.txt
|
||||||
logicalName string // foo.txt
|
logicalName string // foo.txt
|
||||||
baseName string // `post` for `post.md`, also `post.en` for `post.en.md`
|
baseName string // `post` for `post.md`, also `post.en` for `post.en.md`
|
||||||
Contents io.Reader
|
Contents io.Reader
|
||||||
|
@ -101,8 +101,8 @@ func (f *File) Ext() string {
|
||||||
return f.Extension()
|
return f.Extension()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path gets the relative path including file name and extension from
|
// Path gets the relative path including file name and extension.
|
||||||
// the base of the source directory.
|
// The directory is relative to the content root.
|
||||||
func (f *File) Path() string {
|
func (f *File) Path() string {
|
||||||
return f.relpath
|
return f.relpath
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue