如何将精选图片与rmd帖子相关联?

时间:2019-08-29 14:21:14

标签: r r-markdown hugo blogdown

我正在使用(很棒的)雨果主题创建网站。它带有一些示例帖子,每个帖子都显示在帖子列表中并带有缩略图。这些帖子都是.md文件,并且在其开头内容中包括以下内容:

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Placement options: 1 = Full column width, 2 = Out-set, 3 = Screen-width
# Focal point options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
image:
  placement: 2
  caption: 'Image credit: [**Unsplash**](https://unsplash.com/photos/CpkOjOcXdUY)'
  focal_point: ""
  preview_only: false

我已按照说明进行操作,并且在我的页面文件夹中有一个“ featured.png”。我的Rmd的yaml标头看起来像这样:

---
title: "my title"
author: "Kyle Ward"
date: 2019-08-28
categories: ["R"]
tags: ["R Markdown", "packages"]
image:
  placement: 2
  caption: ""
  focal_point: ""
  preview_only: false
projects: ["my-project"]
---

图像缩略图不会像其他所有.md示例帖子一样显示。其他yaml标签也可以。例如,我的帖子与“ my-project”相关联,它具有正确的作者信息,等等。我在做什么错了?

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

通常,在这种情况下,您还需要将缩略图选项添加到.md文件头中:

---
title: "my title"
thumbnail: "page_folder/featured.jpg"
... other params ...
---