如何从'content'子文件夹中添加图像 - 鹈鹕

时间:2017-09-06 20:11:39

标签: pelican

我有一个结构

 conda install -c scitools imagehash

我希望img文件与content/ ├── applications │   └── 2017 │   └── 08 │   └── 30 │   ├── article.md │   └── forecast1.png 文件的目录相同,以便将它们放到:

md

我有ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'

STATIC_PATHS = ['static_files','content']

给出错误:

[alt]({attach}applications/2017/08/30/forecast1.png)

在这个简单的情况下,如何将图像包含到我的WARNING: Unable to find `applications/2017/08/30/forecast1.png`, skipping url replacement. 文件中?

修改 所以我将配置md更改为我的类别:

applications

我还在PATH = 'content' STATIC_PATHS = ['static_files','applications/2017/08/30/img', 'applications/2017/09/01/img'] ARTICLE_PATHS = ['applications', 'cat2', 'cat3'] 之前添加了!,但图片仍未复制到输出中。

EDIT2 当上面应用编辑并更改时{iT}工作[alt]()

1 个答案:

答案 0 :(得分:2)

这适用于我([dcl.init.ref]之后):

content/
├── p001
│   └── myArticle001.md
│   └── img001
│       └── myPic1.png
│       └── myPic2.png
├── p002
│   └── myArticle002.md
│   └── img002
│       └── myPic1.png
│       └── myPic2.png

pelicanconfig.py集合中:

PATH = 'content'
STATIC_PATHS = ['p001','p002']
ARTICLE_PATHS = STATIC_PATHS

md - 文件集中:

![pic_A1]({attach}img001/myPic1.png)
![pic_A2]({attach}img001/myPic2.png)

![pic_B1]({attach}img002/myPic1.png)
![pic_B2]({attach}img002/myPic2.png)

可能您仅在命令开头错过了。所以你可以试试这个:

![alt]({attach}applications/2017/08/30/forecast1.png)

或试试这个:

PATH = 'content'
STATIC_PATHS = ['applications']
ARTICLE_PATHS = STATIC_PATHS
...
![alt]({attach}2017/08/30/forecast1.png)