2016-08-14 26 views
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/blogSTATIC_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. 
+0

在你的模板文件,你是如何引用的东西呢? –

+0

我使用[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

+0

啊......我误解了,认为你修改了一些东西。只是尝试了一个头像的主题,并没有看到一个问题,使用像'AVATAR ='/ images/test/test.jpg'',其中图像是在我的static_paths列表中。我不知道这是一个问题,但是您不需要将'images/blog'指定为静态路径,因为它将包含在图像路径下。另外有趣的是,你正在看到WARNING消息。无论我把什么作为AVATAR的价值,我的网站都没有任何警告。 –

回答

0

随着

content 
├── post1.md 
├── post2.md 
├── siteImages 
│ └──profile.png 

,并使用鹈鹕主题炼丹这个工作对我来说:

SITEIMAGE = '/siteImages/profile.png' 
THEME = 'themes/alchemy' 
PATH = 'content' 
STATIC_PATHS = ['siteImages']