Ruby 在 Rails 上:meta_tags gem

Ruby on Rails: meta_tags gem

我使用 meta_tags gem 来处理所有 SEO 元标记。

但是,当我在 application.html.haml 视图中使用时,它会显示在页面本身上,以便用户也能看到它。

= set_meta_tags title: "app title, keywords...."

知道为什么会这样吗?

这是 HAML 的行为,而不是 meta_tags gem。

-# In a HAML file, ...
= '= will evaluate the ruby code and put the result on the page'
- '- will evaluate the ruby code but not put the result on the page'

参考:http://haml.info/docs/yardoc/file.REFERENCE.html#ruby_evaluation