我正在使用 Middleman 4.2 和 Middleman-blog 4.0.2。
当我有:
<% blog.tags.each do |tag, articles| %>
<%= link_to "#{tag.titleize} - #{articles.size}", tag_path(tag) %>
<% end %>
我得到所需的<a>
元素输出:
<a href="/blog/posts/tags/test-tag/">Test Tag - 1</a>
但是当我将其更改link_to
为一个块时:
<% blog.tags.each do |tag, articles| %>
<%= link_to tag_path(tag) do %>
<%= tag.titleize %> - <%= articles.size %>
<% end %>
<% end %>
我收到语法错误:
/source/blog/index.html.erb:43: syntax error, unexpected ')' ...<< ( link_to tag_path(tag) do ).to_s; @_out_buf << '
我似乎无法弄清楚为什么我无法在这里获得相同的输出。
任何指针?