0
我試圖建立我AVATAR
變量在鵜鶘-bootstap主題鑽我得到以下錯誤:如何將靜態profile.jpg圖像鏈接到所有Pelican文件?
WARNING:root:Unable to find `/pages/images/blog/profile.jpg` or variations.
我的項目的文件系統是這樣的:
content
├── post1.md
├── post2.md
├── images
│ └──blog
│ ├── banner.png
│ ├── favicon.jpg
│ └── profile.jpg
└── pages
└── about.md
我試圖
AVATAR = './images/blog/profile.jpg'
AVATAR = '/images/blog/profile.jpg'
AVATAR = '/content/images/blog/profile.jpg'
這是我在這等問題SO紅:在pelicanconf.py
文件中同時使用What is the correct way to express a path in order to get Pelican generated html to link to an image?。
所以問題是,配置文件圖像(AVATAR
變量)顯示正確的博客文章:鑑於鵜鶘去/images/blog/profile.jpg
其實是圖像。但是,從/pages
加載頁面時,它使用上面的路由。
最後,我鵜鶘的conf使用此路徑:
PATH = 'content'
STATIC_PATHS = ['images']
編輯:我已刪除images/blog
從STATIC_PATHS
,@ScottCarpenter的提醒下。
而且我已經嘗試使用以下行
![Avatar image]({attach}images/blog/profile.jpg)
的結果爲about.md
文件添加相同的圖像是一樣的,使用鵜鶘,bootstrap3主題模板裏面,當它。這次有了這個警告信息。
WARNING:root:Unable to find `/pages/{attach}images/blog/profile.jpg` or variations.
在你的模板文件,你是如何引用的東西呢? –
我使用[pelican-bootstrap3](https://github.com/getpelican/pelican-themes/tree/master/pelican-bootstrap3)主題,在這裏你可以看到模板:[link](https:// github .com/getpelican/pelican-themes/blob/b6ddae910c53ddd7a556ed339e6d66e5d3064b4b/pelican-bootstrap3/templates/includes/aboutme.html)@ScottCarpenter – PabloRdrRbl
啊......我誤解了,認爲你修改了一些東西。只是嘗試了一個頭像的主題,並沒有看到一個問題,使用像'AVATAR ='/ images/test/test.jpg'',其中圖像是在我的static_paths列表中。我不知道這是一個問題,但是您不需要將'images/blog'指定爲靜態路徑,因爲它將包含在圖像路徑下。另外有趣的是,你正在看到WARNING消息。無論我把什麼作爲AVATAR的價值,我的網站都沒有任何警告。 –