它不会将我的网站及其模板呈现到localhost1313

问题描述

(雨果) 尝试运行LocalHost服务器时,我在终端收到此消息:

Veers-MacBook:FullFork veergala$ hugo server
Building sites … WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   | EN  
-------------------+-----
  Pages            |  3  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 33 ms
Watching for changes in /Users/avinashgala/FullFork/{archetypes,content,data,layouts,static}
Watching for config changes in /Users/avinashgala/FullFork/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
WARN 2020/09/11 09:15:32 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

我是Hugo / Terminal的新手,我不知道该怎么办。 谢谢您的时间。

解决方法

您页面的每个页面都有一个“ Kind”:请参阅“ Page Kinds

Hugo寻找一种布局来渲染您的网站:
参见“ Hugo's Lookup Order

如果您没有自己的布局文件夹,则拥有那些_default布局页面,则可以添加declare a theme

以上主题定义中使用的名称必须与/your-site/themes中的文件夹匹配,例如/your-site/themes/my-shortcodes

请参见A Beginner’s Guide to Creating a Static Website with Hugo的“ Ilya Bodrov”作为示例。

别忘了做

hugo server -D

-D选项意味着草稿也应显示在网站上。

默认情况下,所有内容均以草稿模式创建,因此我们现在必须提供此选项。
此命令将显示有关您的站点的简要统计信息,并在启用实时重新加载的情况下启动服务器。实时重新加载只是意味着只要您修改代码,网页就会在浏览器中自动重新加载。