-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make SummayLength configurable #3735
Conversation
It seems that my code is out of date |
helpers/content.go
Outdated
@@ -37,7 +37,7 @@ import ( | |||
) | |||
|
|||
// SummaryLength is the length of the summary that Hugo extracts from a content. | |||
var SummaryLength = 70 | |||
var SummaryLength = 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change the default value. That will break many, many sites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is moved to a config variable, this variable should be removed.
hugolib/config.go
Outdated
@@ -132,4 +133,5 @@ func loadDefaultSettingsFor(v *viper.Viper) { | |||
v.SetDefault("enableGitInfo", false) | |||
v.SetDefault("ignoreFiles", make([]string, 0)) | |||
v.SetDefault("disableAliases", false) | |||
v.SetDefault("SummaryLength", 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the pattern ans start with lower char: SummaryLength > summaryLength
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted above: The default above should remain at 70 (changing that will break many many sites).
hugolib/page.go
Outdated
@@ -611,9 +611,9 @@ func (p *Page) setAutoSummary() error { | |||
var summary string | |||
var truncated bool | |||
if p.isCJKLanguage { | |||
summary, truncated = helpers.TruncateWordsByRune(p.PlainWords(), helpers.SummaryLength) | |||
summary, truncated = helpers.TruncateWordsByRune(p.PlainWords() , p.s.Cfg.GetInt("SummaryLength")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summaryLength
And this needs a line somewhere in the documentation (just add it to this PR). |
Replaced by #3924 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.