Hugo Docsy 图像路径引用多种语言

Hugo Docsy image path referencing with multiple languages

我是静态站点生成器 Hugo with the theme Docsy,但我无法提供正确的路径以便 Hugo 找到我的图像?

我读到 Hugo 的内容组织将在 Page Bundle or in the project's static directory. See Hugo Directory Structure: static 中搜索图像。

我正在为项目中的图像使用 Page Bundle 组织。
我的图像的路径是: My_Hugo_Docsy_Project/content/en/docs/My_Page_Bundle/assets/image_file.jpg

我正在使用常规降价来包含图像,但这不起作用:

![Image1](/assets/image_file.jpg)

我认为 Docsy 的多语言功能(国际化)导致了挂断,它按语言嵌套了内容目录结构。

Docsy's default config.toml, sets contentDir = "content/en".

Setting contentDir effectively changes the "site root" 用于页面捆绑资源,例如图像。 "site root" 目录是 Hugo 开始寻找 image_file.jpg.

的地方
#Hugo root directory when contentDir = "content/en"
`My_Hugo_Docsy_Project/content/en/

#Hugo root directory when contentDir = “content”
My_Hugo_Docsy_Project/content

因此 markdown 中的图片路径为:

![Image1](/docs/My_Page_Bundle/assets/image_file.jpg)