【发布时间】:2018-02-14 00:55:40
【问题描述】:
我有这个在config.toml:
baseURL = "https://my-username.github.io/blog/"
在static/img/foo.png 有一个静态文件。
现在,在content/posts/bar.md,我有以下内容:
---
title: "Bar"
---

我启动hugo server后图片没有显示,所以我检查了元素,发现Hugo为其生成了以下URL:
http://localhost:1313/blog/posts/bar/img/hireme.png
这不是我所期望的;应该是
http://localhost:1313/blog/img/hireme.png
当我使用时,图片显示正确,但这很奇怪:/blog/是baseURL的一部分,为什么我需要重新输入?
【问题讨论】:
-
不知道 Hugo 是如何处理链接标记的,所以只是一个想法:你试过
/img/foo.png吗? -
@unor 渲染为
<img src="/img/foo.png" alt="foo">,即http://localhost:1313/img/hireme.png:(
标签: templates url content-management-system static-files hugo