luizdepra / hugo-coder

A minimalist blog theme for hugo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with UTF-8 character handling in 'see_also' feature

tech-andgar opened this issue · comments

I'm using Hugo and have been exploring the "see_also" functionality that automatically generates links to related posts in a series. I have followed the documentation and added the "series" property to several of my posts, but I'm not seeing the expected "see_also" links in the final compilation of my site.
Captura de Pantalla 2023-07-03 a la(s) 10 27 27 a m

I attempted to debug the problem (although I must admit that I'm not an expert in Go and Hugo), and it appears to be related to how Hugo handles UTF-8 encoding. In particular, I noticed that when I use Spanish characters in my series (such as "lenguaje-de-programación"), Hugo converts these characters into their URL encoding equivalent, producing something like "lenguaje-de-programaci%C3%B3n".

This can be seen in line 6 of code of series - url, where the ´urlize´ function is used.

As a test, I tried changing the Spanish characters to their English equivalent characters (for example, replacing "ó" with "o"), and I found that the "see_also" feature worked as expected.
Captura de Pantalla 2023-07-03 a la(s) 10 26 57 a m

This encoding issue seems to be interfering with the "see_also" functionality when non-ASCII characters are used in series. Is there a workaround for this, or is this a bug that needs to be fixed?

Thank you for your time and assistance.

Hey.

It seems we don't need to use urlize in this case. Let me do a quick check. BRB.

I think I just fixed it. I changed from urlize to anchorize and voilà!

Feel free to reopen this issue if you encounter any related problem.

Hello @luizdepra,

Despite changing from urlize to anchorize, the "see_also" functionality in Hugo is still disrupted by the use of Spanish characters (e.g., "lenguaje-de-programación"). Replacing these with their English counterparts works, but this isn't a long-term solution.

Attached are screenshots showing the issue.

image

image

I would appreciate any further guidance or bug fix updates.

Thank you.

Best,