【发布时间】:2022-02-09 11:26:24
【问题描述】:
我最近将 WordPress 页面中的内容导入了 Hugo。当我运行 hugo serve 时,我收到以下错误消息:
WARN 2020/02/17 20:51:06 found no layout file for "HTML" for "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
相关页面的开头如下:
---
linktitle: "The Title of the Post"
title: "The Title of the Post"
author: "Franz Drollig"
type: post
date: 2020-01-09T14:41:55+00:00
url: /the-title-of-post/
categories:
- Uncategorized
weight: 10
---
This is the content of the post. This is the second sentence of the post.
它位于mysite/content/posts/YYYY-MM-DD-title.md。
layouts 目录为空。但是,themes 目录包含 book 主题。这个主题也在config.toml中配置。
另一个帖子,如下所示,正确呈现。
---
author: "Michael Henderson"
date: 2014-09-28
linktitle: Creating a New Theme
menu:
main:
parent: tutorials
next: /tutorials/github-pages-blog
prev: /tutorials/automated-deployments
title: Creating a New Theme
weight: 10
---
## Introduction
为什么我的帖子没有正确呈现?我该如何解决?
【问题讨论】:
-
我没有使用 Hugo 的经验,但如果它有助于为您指明正确的方向,我会发表评论。这两份文件的正面问题似乎非常不同。我在想
type: post可能是罪魁祸首。是否需要在'post'周围加上引号?如果您完全删除post前面的内容会发生什么?这些链接也可能是 helfpul:gohugo.io/content-management/front-matter 和 gohugo.io/templates/lookup-order -
@epsilon42 你是对的,删除
type: post解决了我的问题。如果您提交您的评论作为答案,我会接受并且您将获得赏金(通常在 2-3 天后)。
标签: wordpress github export custom-wordpress-pages hugo