繁体   English   中英

在 GitHub 页面上找不到资产 Jekyll 博客

[英]Assets not found on GitHub Pages Jekyll Blog

我正在为 jekyll 使用 minima 主题。 我想在我的帖子中添加图片。 _config.yaml我将baseurl设置为/blog ,将url设置为https://mywebsite.com因为我的 jekyll 博客是一个单独的 repo,可通过 mywebsite.com/blog 访问。 在帖子中,我想将图片包含在我有

<figure>
  <img src="{{ site.baseurl }}/assets/pihole.png" alt="PiHole Dashboard"/>
  <center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>

这在我的本地工作正常,但是当部署到 github 页面时,图片不存在。 我可以访问 mywebsite.com/blog/assets/main.css 没问题,但是当我尝试访问图像时,它给了我 404。

检查页面告诉我它确实有正确的位置

figure>
  <img src="/blog/assets/pihole.png" alt="PiHole Dashboard" />
  <center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>

有什么我遗漏的东西没有将我的图像文件上传到 GitHub Pages?

需要在我的根目录中创建一个资产文件夹并将文件放在那里。

<figure>
  <img src={{ "/assets/pihole.png" | relative_url }} alt="PiHole Dashboard"/>
  <center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>

尝试在“欢迎来到 Jekyll”帖子中缺少 Kitty 中的relative_url 图像,但在 index.md 和 about.md 中显示

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM