问题描述
我与Jekyll建立了博客,但我的新帖子无法加载图片.
I made a blog with Jekyll but my new post can't load the images.
我正在尝试按照Jekyll网站上的示例通过将图像路径添加到.md文档来加载它们:
I'm trying to load them following the example on Jekyll site by adding the image path to the .md document:
![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
我将所有图像放在根目录(Github项目)中一个名为_images的文件夹中.当我尝试用这样的行添加它们时,它将行不通:
I got all my images on a folder called _images placed in the root directory (Github project). When I try to add them with a line like this it won't work:
![canvas.png](/_images/canvas.png)
我也已经尝试过:
![canvas.png]({{site.url}}/_images/canvas.png)
我试图更改也在_config.yml上添加这些变量:
I tried to change add these variables on _config.yml also:
baseurl:/reponame
repo:repo url
但是我没有加载图像.
为什么会这样?有谁知道如何加载图像?
Why is this happening? Anyone knows how to make the images load?
推荐答案
在Jekyll中以下划线开头的目录是特殊的,除非要对其进行处理,否则将不使用它们,因为在这种情况下,_images
文件夹.您可以将文件夹重命名为images
,然后将其内容直接放置在_site/images
中,并可以通过以下方式访问:
Directories that starts with an underscore in Jekyll are special, unless they are meant to be processed they won't be used, as in this case the _images
folder. You can rename the folder to images
and then its content would be places directly in _site/images
and can be accessed with:
![My helpful screenshot]({{"/images/screenshot.jpg" | absolute_url}})
这篇关于无法在Jekyll博客文章上加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!