我遇到了与 Hugo-Academic 主题相同的问题,并且上述解决方案对我不起作用。
这是我的.Rmd 文件的YAML 标头,我的pizza.jpg 位于static/img/ 文件夹中。
如您所见,没有显示预览图像:
但是,您确实在项目中内看到了这张图片:
我如何才能正确获得与 academic 主题配合使用的图像预览?
如果您愿意,可以查看我的repo (https://github.com/moldach/moldach.github.com)……但我试图在此处提供足够的信息以供后代使用,因为它会在未来发生变化。
请注意:“Getting Started with...” 项目旁边的项目的图像预览之所以有效,是因为它们是指向.md 而非.Rmd 中的外部网站的链接
已解决:
好的,所以错误是您需要有preview_only:(而不是image_preview:)并注意image: 下的正确缩进(2 个空格键)。
确保您拥有Rmd 和预览图像(命名为featured.jpg/featured.png 位于project 文件夹中的一个子文件夹,如下所示:
可能最好复制粘贴,因为YAML 在适当的间距下很挑剔:
---
title: 'Shiny Dev and Software Release Cycles and Rayshader, Oh My!'
summary: ''
author: "Matthew J. Oldach"
tags: []
categories: []
date: "2019-11-23"
featured: false
draft: false
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: ""
focal_point: ""
preview_only: true
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
projects: []
---