如何修改页面的正文和字段?

How do I modify the body and fields of a page?

Hakyll 是否可以修改 "date"、"author" 等字段,更具体地说是页面正文。例如,我想修改或删除页面的某些部分。

我查看了关于 Hackage 的 Hakyll 文档。有一个叫做 changeField 的函数,可以根据我的需要缝合。但是这个函数是Hakyll 3版本的,我现在用的Hakyll 4.5.0是没有的

要修改页面正文,请使用 withItemBody while compiling the page. You can use it, for instance, with withTags and the tools provided by the tagsoup 包来根据需要修改 HTML 页面的 DOM 树。

至于元数据,据我所知,它是只读的。您可以做的是使用 Hakyll.Web.Template.Context to define your own custom contexts for filling in template fields, possibly using metadata fields to do so. The implementation of contexts such as dateField 说明如何完成。