使用 Wowchemy Hugo Academic 和 Blogdown 工作流程时的图像范围问题

Image scoping issue when using Wowchemy Hugo Academic and Blogdown workflow

我正在关注 ApresHill 的惊人帮助 blog post for creating my website. I have a question regarding the image scoping, I would appreciate it if someone can shed some light. Wowchemy tutorial 说图像可以放在 /assets/media/ 从 Wowchemy v5.1 开始的文件夹下。在此版本之前,它们位于 static 文件夹下。

当我在 yaml 前言中或 post 本身中引用图像时,我的问题与范围界定的差异有关。简而言之,YAML headers 范围适用于 /assets/media/ 中的图像,而 post body 范围适用于 static/media/ 中的图像:

设图片路径为: /assets/media/IMG_IN_ASSETS_MEDIA_FOLDER.jpg /static/media/IMG_IN_STATIC_MEDIA_FOLDER.jpg

---
# This works in YAML
  background:
    image: IMG_IN_ASSETS_MEDIA_FOLDER.jpg
    image_darken: 0.65
    image_parallax: true
    image_position: center
    image_size: cover
    text_color_light: true
  spacing:
    padding: ["20px", "0", "20px", "0"]
---
---
# This doesn't work in YAML
  background:
    image: IMG_IN_STATIC_MEDIA_FOLDER.jpg
    image_darken: 0.65
    image_parallax: true
    image_position: center
    image_size: cover
    text_color_light: true
  spacing:
    padding: ["20px", "0", "20px", "0"]
---

当我尝试将图像插入 post body 时,只有 static 文件夹在范围内

# adding images under `static` folder works
![](/media/IMG_IN_STATIC_MEDIA_FOLDER.jpg) # works 

# images under `/assets/media/` aren't found. I tried a few things here:
![](/media/IMG_IN_ASSETS_MEDIA_FOLDER.jpg)
![](/assets/media/IMG_IN_ASSETS_MEDIA_FOLDER.jpg)
![](../assets/media/IMG_IN_ASSETS_MEDIA_FOLDER.jpg)
# It works when I use the shortcodes though

{{< figure src="IMG_IN_ASSETS_MEDIA_FOLDER.jpg" >}}

为什么 post front matter 和 body 在图像范围界定方面表现不同?我在这里错过了什么?

正如我在 R Studio Community 中听到的那样,这可能是由于 Hugo 或 Blogdown 查找图像的位置不同所致。它还解释了为什么简码可以从 assets 文件夹中插入图像。