Actually, since we already have `#next_page` and `#prev_page` methods, we can just do something like:

```ruby
output = ""

if scope.next_page
  output << '<link rel="next" href="' + url_for(params.merge(param_name => scope.next_page, :only_path => true)) + '"/>'
end

if scope.prev_page
  output << '<link rel="prev" href="' + url_for(params.merge(param_name => scope.prev_page, :only_path => true)) + '"/>'
end
```