mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05: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 {
|
||||
WordCount int
|
||||
FuzzyWordCount int
|
||||
MinRead int
|
||||
ReadingTime int
|
||||
Weight int
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ func (p *Page) ProcessShortcodes(t bundle.Template) {
|
|||
func (p *Page) analyzePage() {
|
||||
p.WordCount = TotalWords(p.Plain())
|
||||
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) {
|
||||
|
|
|
@ -308,8 +308,8 @@ func TestWordCount(t *testing.T) {
|
|||
t.Fatalf("incorrect word count. expected %v, got %v", 500, p.WordCount)
|
||||
}
|
||||
|
||||
if p.MinRead != 3 {
|
||||
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.MinRead)
|
||||
if p.ReadingTime != 3 {
|
||||
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.ReadingTime)
|
||||
}
|
||||
|
||||
checkTruncation(t, p, true, "long page")
|
||||
|
|
Loading…
Reference in a new issue