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

✨ Support for UTF-8 encoded series names; small updates #360

Merged
merged 8 commits into from
Jan 1, 2023

Conversation

pfrogond
Copy link
Contributor

As I write in czech, I noticed that when I use UTF-8 encoded characters (š,ř,ž etc.) in a series name, it won't associate it with any articles. The problem is in the urlize function in the series.html and series-closed.html files.

{{ range $post := sort (index .Site.Taxonomies.series (index .Params.series 0 | urlize)) "Params.series_order" }}

Besides converting the name lowercase and replacing spaces with hyphens it also changes non ASCII characters to URL friendly format (Čeština -> %C4%8Ce%C5%A1tina). That leads to the inability of the next function: {{ if eq $post.Permalink $.Page.Permalink }} to match series names with corresponding posts.

So I changed the code so that now it only converts the name to lowercase and replaces spaces with hyphens.

I also added my personal website, changed one word in the czech translation and added an option to depluralize list names in config.toml file. The last change is useful for non english languages because the pluralize funcition messes up names in other languages.

@nunocoracao
Copy link
Owner

nunocoracao commented Dec 31, 2022

Thanks @pfrogond looks good. Would never caught the urlize issue as my blog is eng only for now. Just need to understand the pluralizeListTitles param you added to the config.toml and we're good to go.

@nunocoracao nunocoracao changed the title Support for UTF-8 encoded series names; small updates ✨ Support for UTF-8 encoded series names; small updates Dec 31, 2022
@nunocoracao nunocoracao added the enhancement New feature or request label Dec 31, 2022
@pfrogond
Copy link
Contributor Author

The pluralizeListTitles is a Hugo function https://gohugo.io/getting-started/configuration/#pluralizelisttitles

Fine for english but poor for pretty much anything else (at least by default, maybe there is a way to translate it but I find it easier to just disable it)

@pfrogond
Copy link
Contributor Author

pfrogond commented Dec 31, 2022

Sorry to add another one, but I just came across this thing. The 200 word limit to display the scroll to top arrow {{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 200) }} in baseof.html caueses problems when there are articles with many images but few words. You have a long page but don't get the arrow because the limit hasn't been reached.

I left the limit on 1 so that the arrow isn't displayed on home page, list pages etc. where there is no word counting.

@nunocoracao nunocoracao merged commit 7db7ee8 into nunocoracao:dev Jan 1, 2023
@rpstreef
Copy link

I'm getting additional padding on the homepage and other list views when I leave the scrollToTop enabled with the default wordcount. I had to set it to 300 to avoid this padding from happening.

@nunocoracao
Copy link
Owner

@rpstreef thanks for the comment, could you please open a new ticket or PR?
I'll look at it for the next release

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

Successfully merging this pull request may close these issues.

3 participants