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

How to add image from within 'content' subfolder - pelican

我得到了一个结构

content/
├── applications
│   └── 2017
│       └── 08
│           └── 30
│               ├── article.md
│               └── forecast1.png

我希望 img 文件与 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 is my category 更改为:

PATH = 'content'
STATIC_PATHS = ['static_files','applications/2017/08/30/img', 'applications/2017/09/01/img']
ARTICLE_PATHS = ['applications', 'cat2', 'cat3']

我还在 [alt]() 之前添加了 !,但图像仍然没有复制到输出。

EDIT2 当应用上面的编辑并更改 ({attach}img/forecast1.png)

时,它会起作用

这对我有用(在 this 之后):

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)