Nasty urls in hack 4 - Google doesn't like them

We’re getting links like

h ttps://www.straygoat.co.uk/blog?14da71d8_page=5&82065f27_page=1&92886be2_page=2&f089d56a_page=4

h ttps://www.straygoat.co.uk/blog?14da71d8_page=3&6c750d88_page=1&92886be2_page=3&f089d56a_page=4

from the Finsweet Hack 4.

Is there any way to make these more SEO friendly?

ROL Webflow - Craig's Initial Project

Thanks

Hey @jonathan3! You can now create and set dynamic ID’s with a plain text field of your CMS. (I used the name field but you can create your own ID’s)

Then on your hack4 filter button buttons, you are going to set the data-anchor attribute to the same field you previously used for the ID

And finally you can add this code to your </body>

<script>
      let buttons = document.querySelectorAll('.hack4-filter-button');

      // Event listener for each button
      buttons.forEach(function (button) {
        button.addEventListener('click', function (e) {
          // Prevent the default button behavior
          e.preventDefault();

          // Get the anchor value from a data attribute
          let url = 'https://www.straygoat.co.uk/blog#' + this.getAttribute('data-anchor');

          // Navigate to the URL
          window.location.href = url;
        });
      });
    </script>

Test it out and let me know if it works! :muscle:

I’m not sure if I’m supposed to delete the original code, or not…

@jonathan3 yes, the original hack code can be removed