Repeatation of class while adding class in twig template
If you don't want to add a class, but to replace the existing classes, you can use setAttribute().

&lt;li{{attributes.setattribute('class', 'page-previous')}}&gt;