I am creating this link tag:
<link rel="canonical" href="<%= request.url %>" />
The problem is just it is the full url with params.
How do I request the url without any params?
I am creating this link tag:
<link rel="canonical" href="<%= request.url %>" />
The problem is just it is the full url with params.
How do I request the url without any params?
request
is an ActionDispatch::Request and that subclasses Rack::Request. Rack::Request has a path
method that might interest you:
<%= request.path %>
If your request.url
is http://example.com/where/is?pancakes=house%3F
then request.path
should be /where/is
.