Using pagination on a page with url with query string data I have an index page that filters entries based on url query strings, eg: site.com/inductees?county=123.

I put together a very simple pagination setup with next/prev links. However, when I click "next" I am brought to site.com/inductees/p2 and I lose my filtered set of entries from the ?county=123 bit.

How can I get pagination working and keep the query string in my url?

Thanks!
In most Craft projects I do I'll create a pagination include file so anything I need that requires pagination, I can just include that and I get the same pagination pattern anywhere within my site when I need it.

While you do have to set the country attribute with each link, sometimes it might get a little tedious to do this manually or you may expand your attributes to include other options, like ?country=123&amp;distance=50.

This is where Craft's craft.request.getQueryStringWithoutPath() comes into play. In Craft 3 this has been changed to craft.app.request.queryStringWithoutPath. But you could do something like this:

{% if craft.request.getQueryStringWithoutPath() %}
  {% set queryString = "?" ~ craft.request.getQueryStringWithoutPath() %}
{% endif %}

&lt;a href="{{ paginate.prevUrl }}{% if queryString is defined %}{{ queryString }}{% endif %}"&gt;Previous&lt;/a&gt;


Then no matter what URL attributes you have, they'll always be included within your pagination links.