anchor_tags
The previous_tag and next_tag return the enabled/disabled previous/next page anchor tag.
Useful to build minimalistic helpers UIs that don't use nav bar links (e.g. :countless, :keyset paginators).
next_tag works with all paginators
previous_tag works with all paginators but :keyset
<%== @pagy.next_tag %>
<%== @pagy.previous_tag %>
Console
require 'pagy/console'
=> true
>> puts @pagy.previous_tag
<a href="/path?example=123&page=2" aria-label="Previous"><</a>
=> nil
>> puts @pagy.next_tag
<a href="/path?example=123&page=4" aria-label="Next">></a>
=> nil
>> puts @pagy.next_tag(text: 'Show Next', aria_label: 'my-next')
<a href="/path?example=123&page=4" aria-label="my-next">Show Next</a>
=> nil
text: 'My Page'- Override the default text (instead of looking up the
pagy.previous/pagy.nextentry in the dictionary) aria_label: 'My Link'- Override the default aria label (instead of looking up the
pagy.aria_label.previous/pagy.aria_label.nextentry in the dictionary) absolute: true- Makes the URL absolute.
path: '/my_path'- Overrides the request path in pagination URLs. Use the path only (not the absolute URL). (see Override the request path)
fragment: '...'- URL fragment string.
querify: tweakSet it to a
Lambdato directly edit the passed string-keyed params hash itself. Its result is ignored.tweak = ->(q) { q.except!('not_useful').merge!('custom' => 'useful') }