【问题标题】:How to include an image in the header of a blogdown post如何在 blogdown 帖子的标题中包含图像
【发布时间】:2020-06-12 07:17:49
【问题描述】:

我正在使用 Academic Hugo 主题在 R 中构建网站。

我使用 RMarkdown 文件创建了一篇博文。如果我有兴趣在帖子的标题中插入图片,我应该将其保存到文件夹结构中的哪个路径以及如何将其包含在我的 YAML/markdown 代码中?

我的 YAML 如下:

---
title: "Do oil prices explain the South African Rand's Performance?"
author: "Tangeni Shatiwa"
date: 2020-06-11T21:13:14-05:00
tags: ["South African Rand", "Brent Crude Oil", "Global Uncertainty","Non-Linear Spline Regression"]
output: html_document
---

理想情况下,我希望在帖子内容开始之前出现在标题下方的图片

TIA!

【问题讨论】:

    标签: r blogdown


    【解决方案1】:

    有可能!您可以将名为 featured.jpg(或 featured.png)的文件包含在您的 post markdown 文件的文件夹中。

    那你只适配 YAML 头:

    ---
    title: "Do oil prices explain the South African Rand's Performance?"
    author: "Tangeni Shatiwa"
    date: 2020-06-11T21:13:14-05:00
    tags: ["South African Rand", "Brent Crude Oil", "Global Uncertainty","Non-Linear Spline Regression"]
    output: html_document
    image:
      caption: "Oil can"
      focal_point: "Center"
      alt_text: This is a picture of oil can.
    ---
    

    它被称为特色图片,您可以在documentation 中阅读更多选项。它看起来例如比如this post(见source code)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-13
      • 1970-01-01
      • 2020-10-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-08
      • 1970-01-01
      相关资源
      最近更新 更多