我最近升级了 Jekyll,map
似乎不再适用于我的液体模板。在我有之前
{{ page.categories | map: "capitalize" | join ", " }}
它按预期工作,产生
Programming, Ember, d3
但现在它产生
, ,
Jekyll 中包含一个array_to_sentence_string
函数,但这并没有将类别大写。
有没有其他人遇到过这个问题?
First, please update to Jekyll's latest version in case you didn't already. The guys working on it are constantly fixing bugs and improving it.
Well, I got it working here. I created a new Jekyll site using jekyll new test
and modified my index.html:
---
layout: default
title: Your New Jekyll Site
categories: [my, new, site]
---
<p>{{ page.categories | map: "capitalize" | join: ", " }}</p>
When I build it, My, New, Site
is appearing correctly. So, try to use correct YAML array syntax ([..., ..., ...]
), upgrade to latest version of Jekyll and it should work. :)