由于我的问题很简单,我试图避免使用宝石。
我的网站有以下 ?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
在得到一些帮助后,我被告知?page=
是唯一真正重要的,因为我的所有内容都可以在没有任何查询参数的情况下访问,除了分页。
所以现在我有这个:
<link rel="canonical" href="<%= "http://#{request.host + request.fullpath}" %>">
所以我的问题是我如何修改它,所以它只放置 URL,如果它存在,也会放置 ?page= 但忽略所有其他参数?