5

我想把外部图像放在我用Pelican创建的博客上

所以我尝试:

some text

.. image:: http://example.com/image.png
    :alt: Alt text

运行“pelican -s pelicanconf.py”后出现错误:

ERROR: Better Fig. Error: image not found: /Users/kendriu/sources/pelican-blog/contenthttp:/example.com/image.png
ERROR: Could not process ./4_joe.rst
   | [Errno 2] No such file or directory: u'/Users/kendriu/sources/pelican-blog/contenthttp:/example.com/image.png'

而且我的帖子里没有图片。

问题是:如何将外部图像放在我的博客中。

4

1 回答 1

0

Pelican 期望路径在内容目录中。一般来说,这是一个好主意,因为拉取内容并使用其他人的带宽是不友好的。

您必须使用原始标签来执行此操作,如下所示:

.. raw:: html 
      <img src="http://example.com/image.jpg" alt="alt text">

最好的解决方案是下载图像(假设您有权限),然后将其包含在您的内容文件夹中,然后自己托管它,这是默认行为。

更新

要从谷歌驱动器托管图像,请参阅此讨论:在网站上显示存储在谷歌驱动器中的文件(例如图像)

Mori 的解决方案对我有用:

https://drive.google.com/uc?id=FILE-ID

在上面的示例中转换为:

.. raw:: html 
      <img src="https://drive.google.com/uc?id=0B9o1MNFt5ld1N3k1cm9tVnZxQjg">

使用 Google Drive API 就像一个魅力。

于 2015-02-25T17:40:16.950 回答