在 GitHub 页上未找到资产 Jekyll Blog
Assets not found on GitHub Pages Jekyll Blog
我正在使用 jekyll 的 minima 主题。我想将图像添加到我的 post 中。在 _config.yaml
中,我将 baseurl
设置为 /blog
并将 url
设置为 https://mywebsite.com
因为我的 jekyll 博客是一个单独的 repo,可以通过 mywebsite 访问。com/blog.在 post 我想把图片包含在我有
<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 页面的东西?
需要在我的根目录中创建一个资产文件夹并将文件放在那里。
<figure>
<img src={{ "/assets/pihole.png" | relative_url }} alt="PiHole Dashboard"/>
<center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>
像Kitty image is missing in 'Welcome to Jekyll' post but shown at index.md and about.md
那样尝试relative_url
我正在使用 jekyll 的 minima 主题。我想将图像添加到我的 post 中。在 _config.yaml
中,我将 baseurl
设置为 /blog
并将 url
设置为 https://mywebsite.com
因为我的 jekyll 博客是一个单独的 repo,可以通过 mywebsite 访问。com/blog.在 post 我想把图片包含在我有
<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 页面的东西?
需要在我的根目录中创建一个资产文件夹并将文件放在那里。
<figure>
<img src={{ "/assets/pihole.png" | relative_url }} alt="PiHole Dashboard"/>
<center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>
像Kitty image is missing in 'Welcome to Jekyll' post but shown at index.md and about.md
那样尝试relative_url