Hide Blog URL Slug | Squarespace 7.1

Use JavaScript (to remove /blog/ in the front-end)

You can use JavaScript to manipulate the URL on the client side so that it doesn’t show /blog/.

Here’s how you can do it:

  1. Go to Settings:

    In your Squarespace dashboard, go to Website > Pages > Website Tools > Code Injection.

  2. Add Custom JavaScript:

    In the Footer section of the Code Injection area, add the following JavaScript

<script>

// Check if we're on a blog page

if (window.location.pathname.indexOf('/blog/') !== -1) {

// Replace '/blog/' with '/' in the URL

var newUrl = window.location.pathname.replace('/blog/', '/');

history.pushState(null, null, newUrl);

}

</script>

Previous
Previous

Add a line in Blog “Read More” | Squarespace 7.1