Html Jekyll:array\u to\u句子\u字符串未定义方法

Html Jekyll:array\u to\u句子\u字符串未定义方法,html,jekyll,liquid,Html,Jekyll,Liquid,在前面的内容中定义了标签的示例帖子 --- layout : blog tags: health, covid --- # COVID-19 vaccines: Get the facts Looking to get the facts about the new COVID-19 vaccines? Here's what you need to know about the different vaccines and the benefits of getting vaccinate

在前面的内容中定义了标签的示例帖子

---
layout : blog
tags: health, covid
---

# COVID-19 vaccines: Get the facts

Looking to get the facts about the new COVID-19 vaccines? Here's what you need to know about the different vaccines and the benefits of getting vaccinated.
我希望标签被合并并显示在帖子中

有一个名为
array\u to\u sensume\u string
的过滤器,它基本上连接了文档中记录的所有标记(是的,不需要手动循环每个标记)

我在代码中使用了
{page.tags | array_to_句子_字符串}
来显示标记

但是,在构建过程中,我不断收到以下错误消息

lib/jekyll/filters.rb:153:in `array_to_sentence_string': undefined method `length' for nil:NilClass (NoMethodError)
我是不是遗漏了什么


谢谢更新:我找到了解决方案。我在对象中添加了
map:'to_liquid'
,它开始工作

{{ page.tags | map: 'to_liquid' | array_to_sentence_string  }}
这是页面的完整代码

---
layout: main
---
<h1>{{ page.title }}</h1>
<p class="info">    
    {{ page.date | date_to_string }} 
    Tags :  {{ page.tags | map: 'to_liquid' | array_to_sentence_string  }}
</p>

{{ content }}
---
布局:主要
---
{{page.title}}

{{page.date | date_to_string} 标记:{{page.Tags | map:'to_liquid'| array_to_statement_string}

{{content}}
很可能是您的标签格式-当前为字符串。出于这样的原因,我倾向于避免使用空格分隔的类别和标记格式。虽然您已经找到了一个解决方案,但另一个解决方案可能是将其更改为阵列:

tags:
  - health
  - covid