使用Jekll处理内容丰富的文本



我试图渲染一个富文本字段来自Contentful到Jekyll....但我不能让它工作。有人在这方面取得过成功吗?我已经安装了https://github.com/contentful/rich-text-renderer.rb作为宝石& &;插件,但没有任何指示,使它与Jekyll工作。

我能够得到{{ page.body.content[0].content[0].value }}的第一段,但显然不是这样的。和{{ page.body.content | rich_text }}抛出错误。

有人知道怎么让它工作吗?

如果有帮助的话,这里是YML文件

- sys:
id: 58za8Qb9b9ahqvxcTBTESb
created_at: !ruby/object:DateTime 2022-05-30 06:05:14.325000000 Z
updated_at: !ruby/object:DateTime 2022-05-30 17:45:38.289000000 Z
content_type_id: blogPost
revision: 8
title: This is for you Christine
link: this-is-for-you-christine
short_description: A working blog using Contentful and Jekyll
body:
nodeType: document
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: 'Here it is... a wonderful thing. A headless static site-generated
blog. My JAMstack, you ask: '
marks: []
data: {}
- nodeType: unordered-list
data: {}
content:
- nodeType: list-item
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: Contentful - CMS
marks: []
data: {}
- nodeType: list-item
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: 'Github - repository, '
marks: []
data: {}
- nodeType: list-item
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: 'Jekyll - SSG, '
marks: []
data: {}
- nodeType: list-item
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: Netlify - hosting
marks: []
data: {}
- nodeType: list-item
data: {}
content:
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: 'IDE - Gitpod '
marks: []
data: {}
- nodeType: paragraph
data: {}
content:
- nodeType: text
value: The cost of running. ABSOLUTELY FREE! Time to set up... once I knew
what to do, we won't discuss research time... but we can say I deserve another
3-day weekend. Aside... learned that I can understand developers speaking
in Portuguese... cause, yes, that's what it took! Anyway... time to set
up... under an hour. You're welcome! Of course, you are asking why this
is one large block paragraph? I still have to figure out displaying rich
text.
marks: []
data: {}

所以原来Contentful有一个longText/Markdown选项。所以不需要富文本。

最新更新