3

为了有一个更干净的布局,我希望我的每篇文章都与所有必需的资产(如图像等)一起驻留在自己的目录中。使用雨果或任何类似工具可以做到这一点吗?如果是这样,怎么做?

问题是每个帖子旁边的文件不会被复制到与相应帖子的 html 文件相同的 www 导出目录中(或者,使用正确的最终位置重建的图像 url)。

4

1 回答 1

3

I found a solution for Hugo.

Front matter (omit url):

---
author: abc
date: 2019-01-14 21:23:43+00:00
draft: false
title: 'bla'
type: post
---

Markdown post file is an index file now:

hugo new 2019-01-14-your-post-title/index.md

That way you won't have /2019/01/14/your-post-title urls, you get /2019-01-14-your-post-title/ instead, which is fine by me. Now you can put images into content/2019-01-14-your-post-title/ and reference them from the markdown index.md file directly without using any paths or having to store them in a central location first.

于 2019-01-17T21:17:55.953 回答