Skip to content
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

Show '…' after summary when it is truncated #374

Merged
merged 3 commits into from
Oct 5, 2023
Merged

Show '…' after summary when it is truncated #374

merged 3 commits into from
Oct 5, 2023

Conversation

TetraTheta
Copy link
Contributor

This will show after summary text if it is truncated.

before

I think I should provide option for site owner what character to display instead of , but I can't decide what config name it should have. I don't know if I can use Hugo's variable/param in SCSS style neither.

If we can use Hugo variable in SCSS, the config would be put under params.hb.blog., but summary-truncation-indicator doesn't seem to be nice or intuitive word for describing this.

Currently, it should be overridden by custom style in index.scss like this:

.summary-truncated::after { content: "$"; } /* $ is random character */

If we can't use Hugo's param, telling people about modifying index.scss like that would be required.


Not that related to this PR, but hasCJKLanguage is broken in Hugo.

I think we should suggest people not to set hasCJKLanguage to true even though their site is written with CJK language.
I found this problem while making my customization (and PR).

They claim hasCJKLanguage as

This will make .Summary and .WordCount behave correctly for CJK languages.

but it doesn't.

.Summary returned less words than 70 words/characters which is default value of summaryLength.
Turning it off returned much longer, consist length of summary text.

It also didn't processed some characters.
I found that there is weird & character at the end of summary text. According to content of that post, it should be " instead. I think " was initially ", but was truncated, only lefting &.

This is bug of Hugo, not HB Framework. But I think it would be worthy to tell people using HB Framework that hasCJKLanguage will cause unexpected behavior, contrary to what Hugo Official Documentation says.

At least, with that suggestion, they won't experience same problem that I had.

@razonyang
Copy link
Member

I think I should provide option for site owner what character to display instead of …

I didn't see other chars used for this purpose, let others open a feature request if they really need to tweak it via configuration.

@mergify mergify bot merged commit bca7aaa into hbstack:main Oct 5, 2023
1 check passed
@github-actions github-actions bot mentioned this pull request Oct 5, 2023
@razonyang
Copy link
Member

razonyang commented Oct 5, 2023

Thanks, it may not very useful, since the summaries is up to 3 rows, otherwise hidden and place the ellipsis at the end, beside it will show 4-5 dots at the end in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants