-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Need a new fix and test for page variable .Truncated #880
Comments
bep
added a commit
to bep/hugo
that referenced
this issue
Feb 5, 2015
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide. Fixes gohugoio#880
Closed
Amazing, @bep! And such a fast response too! Thank you for your great work! |
tychoish
pushed a commit
to tychoish/hugo
that referenced
this issue
Aug 13, 2017
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide. Fixes gohugoio#880
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Previously, in Hugo v0.12, the formerly undocumented
.Truncated
may returntrue
even when the summary contains the entire content, i.e. not truncated, for Hugo's automatically generated summary (i.e. no user<!--more-->
tag). The reason is due to whitespaces, as seen in the following example:helpers.TruncateWordsToWholeSentence()
gives:whereas
strings.TrimSpace()
gives:I tried to remedy that situation with the following one-line fix:
Unfortunately,
strings.Join(strings.Fields(s), " ")
turns out to be a rather expensive operation that "adds about 10% to the processing time" as @bep has discovered (Good catch!) while optimizing performance for the upcoming Hugo v0.13 release, so @bep had to disable it for the time being: f8704c1#diff-204b5518c5299155dd3b72a4299751f9L181I agree with @bep's assessment: "if really needed, should be solved differently."
There should be a more efficient way to determine whether the content were truncated. Besides, few people uses the
.Truncated
, and the worst it could happen is that there would be "Read More..." links appearing even for very short posts (i.e. no big deal). So, there is no urgency to fix it in v0.13 especially when we want to make a release ASAP.Hence this reminder to deal with this issue in the future, maybe for v0.14 or v0.15. ;-)
The text was updated successfully, but these errors were encountered: