[英]How to include an url in application.html.erb in rails 6?
[英]Rails: How to include meta tags in views and not in application.html.erb?
我想在首页视图中包含元标记。 但是我不想直接将它包含在application.html.erb
文件的头部,因为这将导致它在所有页面上包含meta标签,这对我的应用程序来说是多余的。
你可以放
<% if content_for?(:head) %>
<%= yield(:head) %>
<% end %>
在application.html.erb
布局的head
部分。
然后,在要包含这些标签的视图中:
<% content_for :head do %>
<!-- your tags -->
<% end %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.