我只想输入我的ruby网站的关键字和主页说明。主页上有2个文件:
1- main_controller
2- home_page.html.erb
<% content_for :html_title, 'Erratum HUmanum Est' %>
<div class="clear"></div>
<div id="video">
<div class="container">
<div class="video-glow">
<h1><%= t('application.home_page.heading')%></h1>
<div class="clear"></div>
<div class="video-section">
<iframe width="418" height="235" src="https://www.youtube.com/embed/sfsfsfsfsfsfQ?rel=0;hd=1" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如何在这些页面上输入元描述和关键字?(我不想为此输入任何新的红宝石宝石)谢谢,罗马
在您的内容中application.html.erb添加如下内容:
<meta name="description" content="<%= yield(:description) %>" />
<meta name="keywords" content="<%= yield(:keywords) %>" />
Run Code Online (Sandbox Code Playgroud)
然后home_page.html.erb添加这样的东西;
<%= provide(:description, 'I would like to enter keywords and a description of the home page only of my ruby website. The home page has ') %>
<%= provide(:keywords, 'Home, fred, grace, heaven, george') %>
Run Code Online (Sandbox Code Playgroud)
当您不传递任何内容时,它将保持空白且没有meta_tags。