首页 > 解决方案 > 如何让 GIF 出现在 Github Pages 帖子上?

问题描述

我发现我可以在 README.md 页面上显示一个 gif,如下所示:

![gif](https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif)

或者像这样:

<img src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif' />

但是,当我将它们添加到博客文章中时,这些相同的代码行不起作用。我需要在布局中添加一些东西吗?还是在 Github Pages 中关闭?

我发现它们会在托管 gif 时出现在博客文章中,gifs.com但在托管在 Github 上时不会出现。例如,这有效:

<iframe src='//gifs.com/embed/k8A5jN' frameborder='0' scrolling='no' width='1280px' height='720px' style='-webkit-backface-visibility: hidden;-webkit-transform: scale(1);' ></iframe>

但这不是:

<iframe src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif' frameborder='0' scrolling='no' width='1280px' height='720px' style='-webkit-backface-visibility: hidden;-webkit-transform: scale(1);' ></iframe>

我想直接在 github.com 上托管它。

标签: github-pages

解决方案


您的链接转到网页。使用直接链接或适当的目录

尝试这个:

<img src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif?raw=true' />

推荐阅读