title: How to get a canonical url for a dynamically generated urls on rails?
body: <p>I implemented canonical url for homepage as follows: I added this line</p>
  
  <pre><code>  &lt;link rel='canonical' href='https://example.com/'&gt; 
  </code></pre>
  
  <p>I added this line on <code>index.html.erb</code> in <code>header</code> section. It is working fine. </p>
  
  <p>Now I have dynamic routes generating line as follows: </p>
  
  <pre><code>&lt;a href "&lt;%= search_equipments_path(:category_id =&gt; category.id) %&gt;"&gt;
  </code></pre>
  
  <p>I tried with following:</p>
  
  <pre><code>&lt;a rel='canonical' href="&lt;%= search_equipments_path(:category_id =&gt; category.slug) %&gt;"&gt;
  </code></pre>
  
  <p>But didn't work.  </p>