hugo-next / hugo-theme-next

Easily & powerful theme for Hugo engine.
https://hugo-next.eu.org
MIT License
214 stars 38 forks source link

Url包含dot,且defaultContentLanguage为en时,post互相覆盖问题 #43

Open finisky opened 2 years ago

finisky commented 2 years ago

请按照此新功能模版提供相关信息,如详细的功能描述或同类效果屏幕截图,这将有助于我们进行调查。 (Please follow this new feature template to provide relevant information, such as detail description for feature or some screenshots, which will help us investigate.)

新功能描述 (New feature description)

defaultContentLanguage是en,post中同时有a.mda.en.md,则只会生成a.html (这个是Hugo处理多语言的问题),a.en.html会缺失。在其他主题也存在同样问题,应该是Hugo的通用问题。

目前的解决方案是将defaultContentLanguage设为zh-CN。

参考:

https://gohugo.io/content-management/multilingual/#localizing-permalinks

Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory)

效果参考截图 (Screenshots if it possible)

elkan1788 commented 2 years ago

建议可以考虑换成文件夹的管理方式会更清晰些,比如在 content 目录下创建对应语言的子目录,亲测这样是有效果的,可以正常生成多语言网页文件。

finisky commented 2 years ago

之前尝试过,确实有效。不过由于Hexo可以支持a/a.en/,如果迁移URL的话,之前页面的SEO就全没了

可能是个corner case,我自行处理一番即可

elkan1788 commented 2 years ago

之前尝试过,确实有效。不过由于Hexo可以支持a/a.en/,如果迁移URL的话,之前页面的SEO就全没了

可能是个corner case,我自行处理一番即可

关于URL的SEO问题完全不用担心,直接使用 Hugo 中的 aliases 别名功能,可以让之前的URL都转发过来。