我使用hugo-icon单页主题构建了一个静态站点,并被要求为产品描述添加一个新页面。到目前为止,我已经阅读了许多关于堆栈的教程/答案,并观看了Mike Danes videos,但无法获得要呈现的新页面。
当我运行以下命令hugo new products/product1/_index.md时,会生成一个指向product1的url,但不会呈现任何内容。这是我的_index.md文件的内容;
---
title: "Product1"
date: 2021-05-24T14:47:36+01:00
draft: false
---
product1 info我期望两件事中的一件;在url上看到呈现的'product1信息‘。或者我在文件夹结构中的某个地方放置了一个同名的html文件,以呈现文本等。我尝试了多个位置来放置html,但仍然看不到任何东西。
有没有人能解释一下或者举个例子给雨果图标主题添加一个新页面,并解释一下我是否遗漏了一个基本的概念。
配置:
# Main config file for icon theme.
theme = ["hugo-icon"]
baseURL = "https://www.example.com/"
languageCode = "en-ie"
title = "my site"
[params]
author = "Me"
description = "My site"
# Hero section (from here on is for icon theme)
[params.hero]
img = "images/hero_bg_green.jpg"
title = "My Site"谢谢
发布于 2021-08-06 23:02:34
我错过了这个基本的设计模式。在布局下创建的每个文件夹都需要一个模板。在我的示例中,每个页面都设计在single.html文件中,如下所示
Layouts
page1
single.html
page2
single.html需要在content/pages/page-one.md内的content文件夹中定义路径,如下所示,其中type通过其类型定义映射到文件夹名称
type : "page1"
title: "Page 1"
date: 2021-05-27T11:16:39+01:00
draft: false因此,我的url是www.example.com/pages/page-one.html,它是在layouts/page1/single.html中设计的,并通过类型定义映射到www.example.com/content/pages/page-one.md
content/中的.md文件...指定指向url的路径。类型定义指定从布局呈现哪个页面/...
https://stackoverflow.com/questions/67673384
复制相似问题