ruby on rails - Adding META keywords and description on Home Page only -


i enter keywords , description of home page of ruby website. home page has 2 files :

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> 

how can enter meta description , keywords on these pages? (i not want enter new ruby gem this) thanks, roman

in application.html.erb add this;

<meta name="description" content="<%= yield(:description) %>" /> <meta name="keywords" content="<%= yield(:keywords) %>" /> 

then in home_page.html.erb add this;

<%= provide(:description, 'i enter keywords , description of home page of ruby website. home page has ') %>   <%= provide(:keywords, 'home, fred, grace, heaven, george') %>   

when not pass anything, remain empty no meta_tags.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -