I’m trying to avoid using a gem because of the simplicity of my question.
My website has the following ?params=
"type" just filters by type. if this isnt specified they're all lumped together
"sort" sorts by date/whats hot/latest
"view" changes compact view/list view
"scroll" isnt even used yet, its for infinite scroll on or off which i havent put in yet
"reset" is a link when you click the logo (not the home link) that resets all session params to "all" and "whats hot" (the default)
"page" is the pagination which i think is the only really important one
After getting some help, I was informed ?page= is the only really important one, as all my content can be access without any query params, EXCEPT pagination.
So now i have this:
<link rel="canonical" href="<%= "http://#{request.host + request.fullpath}" %>">
So my question is how do i modify this so it only puts the URL, and also puts ?page= if its present but ignores all the other params?
This seems to wrok
<link rel="canonical" href="<%= "http://#{request.host + url_for(:page => params[:page]) }" %>">