replicatedhq / hugo-algolia

Enables search with Algolia in Hugo static sites
48 stars 11 forks source link

Fix url jump error, add Chinese support. 修复url跳转,支持中文 #23

Open Charles94jp opened 2 years ago

Charles94jp commented 2 years ago

Adaptation: Hugo's url will handle spaces and symbols. The content of the article supports Chinese. url处理空格和标点符号,修复在文章中跳转另一个文章时url拼接错误 文章content支持中文(基本汉字)

URL Jump Bug

For example I created a post with the command hugo new "posts/Hello World.md"

My browser's current url is https://blog.example.com/. When I search for "hello world", there is an article called "Hello World" in the search results. When I click on it, it jumps to https://blog.example.com/posts/Hello%20World, the result is 404. Because the actual address of this post is https://blog.example.com/posts/hello-world.

Another bug is that when my current url is https://blog.example.com/posts/hello-world. When I search and jump to another post called "test", my url becomes https://blog.example.com/posts/hello-world/posts/test instead of https://blog.example.com/posts/test.