将 Netlify CMS 与 Hugo 结合使用 - 创建 Academic Hugo 主题的内容
Using Netlify CMS with Hugo - creating content of Academic Hugo theme
我正在尝试将 Netlify CMS 集成到 Academic Hugo 主题中。我想构建一个 config.yml,其中包含 post、演讲等的集合。我的问题类似于。我能够配置每个 post 的一些字段,但我无法包含包含在 []:
中的变量
+++
title = "Academic: the website designer for Hugo"
date = 2016-04-20T00:00:00
lastmod = 2018-01-13T00:00:00
draft = false
tags = ["academic"]
summary = "Create a beautifully simple website or blog in under 10 minutes."
[header]
image = "headers/getting-started.png"
caption = "Image credit: [**Academic**](https://github.com/gcushen/hugo-
academic/)"
[[gallery_item]]
album = "1"
image = "https://raw.githubusercontent.com/gcushen/hugo-
academic/master/images/theme-default.png"
caption = "Default"
+++
请问config.yml能输出这种md吗?
非常感谢您的帮助!
更新:
最后我能够做到,这是我遇到问题的另一种情况:
+++
# About/Biography widget.
widget = "about"
active = true
date = 2016-04-20T00:00:00
# Order that this section will appear in.
weight = 5
# List your academic interests.
[interests]
interests = [
"Artificial Intelligence",
"Computational Linguistics",
"Information Retrieval"
]
# List your qualifications (such as academic degrees).
[[education.courses]]
course = "PhD in Artificial Intelligence"
institution = "Stanford University"
year = 2012
[[education.courses]]
course = "MEng in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2009
[[education.courses]]
course = "BSc in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2008
+++
这里是解决方案,如果它可以帮助某人:
- file: "content/home/about.md"
label: "About"
name: "about"
fields:
- {label: "Widget (Don't modify)", name: "widget", widget: "string", default: "about"}
- {label: "Active", name: "active", widget: "boolean", default: true }
- {label: "Date", name: "date", widget: "datetime" }
- {label: "Weight", name: weight, default: 5}
- {label: "Interests", name: interests, widget: object, fields: [
{label: "Interests list", name: "interests", widget: "list",
default: ["Artificial Intelligence"]}]}
- {label: "Education", name: "education", widget: "object", fields: [
{label: "courses", name: "courses", widget: "list", fields: [
{label: Course, name: course , widget: string},
{label: Institution, name: institution, widget: string},
{label: Year, name: year, default: 2010}]}]}
- { label: "Body", name: "body", widget: "markdown", required: false }
非常感谢!
对于嵌套字段,您将使用 list
或 object
小部件。
对于 "header",您将使用 Netlify CMS object widget, and for "gallery_item" you would use the list widget。
示例:
- label: "Header Settings"
name: "header"
widget: "object"
fields:
- {label: "Image", name: "image", widget: "image"}
- {label: "Caption", name: "caption", widget: "markdown"}
我正在尝试将 Netlify CMS 集成到 Academic Hugo 主题中。我想构建一个 config.yml,其中包含 post、演讲等的集合。我的问题类似于
+++
title = "Academic: the website designer for Hugo"
date = 2016-04-20T00:00:00
lastmod = 2018-01-13T00:00:00
draft = false
tags = ["academic"]
summary = "Create a beautifully simple website or blog in under 10 minutes."
[header]
image = "headers/getting-started.png"
caption = "Image credit: [**Academic**](https://github.com/gcushen/hugo-
academic/)"
[[gallery_item]]
album = "1"
image = "https://raw.githubusercontent.com/gcushen/hugo-
academic/master/images/theme-default.png"
caption = "Default"
+++
请问config.yml能输出这种md吗?
非常感谢您的帮助!
更新:
最后我能够做到,这是我遇到问题的另一种情况:
+++
# About/Biography widget.
widget = "about"
active = true
date = 2016-04-20T00:00:00
# Order that this section will appear in.
weight = 5
# List your academic interests.
[interests]
interests = [
"Artificial Intelligence",
"Computational Linguistics",
"Information Retrieval"
]
# List your qualifications (such as academic degrees).
[[education.courses]]
course = "PhD in Artificial Intelligence"
institution = "Stanford University"
year = 2012
[[education.courses]]
course = "MEng in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2009
[[education.courses]]
course = "BSc in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2008
+++
这里是解决方案,如果它可以帮助某人:
- file: "content/home/about.md"
label: "About"
name: "about"
fields:
- {label: "Widget (Don't modify)", name: "widget", widget: "string", default: "about"}
- {label: "Active", name: "active", widget: "boolean", default: true }
- {label: "Date", name: "date", widget: "datetime" }
- {label: "Weight", name: weight, default: 5}
- {label: "Interests", name: interests, widget: object, fields: [
{label: "Interests list", name: "interests", widget: "list",
default: ["Artificial Intelligence"]}]}
- {label: "Education", name: "education", widget: "object", fields: [
{label: "courses", name: "courses", widget: "list", fields: [
{label: Course, name: course , widget: string},
{label: Institution, name: institution, widget: string},
{label: Year, name: year, default: 2010}]}]}
- { label: "Body", name: "body", widget: "markdown", required: false }
非常感谢!
对于嵌套字段,您将使用 list
或 object
小部件。
对于 "header",您将使用 Netlify CMS object widget, and for "gallery_item" you would use the list widget。
示例:
- label: "Header Settings"
name: "header"
widget: "object"
fields:
- {label: "Image", name: "image", widget: "image"}
- {label: "Caption", name: "caption", widget: "markdown"}