mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-17 06:12:24 +00:00
renaming MinRead to ReadingTime and adding to documentation.
This commit is contained in:
parent
50a7f97a62
commit
3851117c25
2 changed files with 707 additions and 707 deletions
|
@ -63,7 +63,7 @@ type File struct {
|
||||||
type PageMeta struct {
|
type PageMeta struct {
|
||||||
WordCount int
|
WordCount int
|
||||||
FuzzyWordCount int
|
FuzzyWordCount int
|
||||||
MinRead int
|
ReadingTime int
|
||||||
Weight int
|
Weight int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ func (p *Page) ProcessShortcodes(t bundle.Template) {
|
||||||
func (p *Page) analyzePage() {
|
func (p *Page) analyzePage() {
|
||||||
p.WordCount = TotalWords(p.Plain())
|
p.WordCount = TotalWords(p.Plain())
|
||||||
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
||||||
p.MinRead = int((p.WordCount + 212) / 213)
|
p.ReadingTime = int((p.WordCount + 212) / 213)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) permalink() (*url.URL, error) {
|
func (p *Page) permalink() (*url.URL, error) {
|
||||||
|
|
|
@ -308,8 +308,8 @@ func TestWordCount(t *testing.T) {
|
||||||
t.Fatalf("incorrect word count. expected %v, got %v", 500, p.WordCount)
|
t.Fatalf("incorrect word count. expected %v, got %v", 500, p.WordCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.MinRead != 3 {
|
if p.ReadingTime != 3 {
|
||||||
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.MinRead)
|
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.ReadingTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkTruncation(t, p, true, "long page")
|
checkTruncation(t, p, true, "long page")
|
||||||
|
|
Loading…
Reference in a new issue