2

我尝试了几种方法,但到目前为止都没有。我想在我的主博客页面上包含用 R markdown (.Rmd) 编写的博客文章的图像预览,其中通常显示许多文章和项目。我可以使用从 Hugo here获取的以下代码使其在普通降价(.md)中工作academic-theme

+++
# Optional image to display on homepage (relative to `static/img/` folder).
image_preview = "bubbles.jpg"
+++

结果将如下所示参见第 1 节Projects)。

但是,我不知道如何将其翻译为.Rmd yaml我的博客文章中的。我可以在顶部使用下面的图像,但由于我使用的是toc目录选项,因此图像仅显示在之后toc,因此不会出现在主页的帖子预览中。

---
title: some title
author: some author
date: 'some date'
slug: some-slug
categories:
  - some category
tags:
  - some-tag
output:
  blogdown::html_page:
    toc: true
    number_sections: true
    toc_depth: 2
---

![](/post/img/some_img.png)

理想情况下,图像仅显示在主页的预览中,而不是实际的博客文章中(目的是用视觉上吸引人的图像“吸引”读者到实际内容)但如果不可能,否则我也很好,如果只要它显示在主页的预览中,图像就会显示在实际帖子的顶部。

4

1 回答 1

1

如果image_preview参数与md文档一起使用,它也应该与 Rmd 一起使用,前提是您使用:我猜的语法:

---
title: some title
author: some author
date: 'some date'
slug: some-slug
categories:
  - some category
tags:
  - some-tag
output:
  blogdown::html_page:
    toc: true
    number_sections: true
    toc_depth: 2
image_preview: 'bubbles.jpg'
---
于 2017-10-03T09:00:58.440 回答