How-to: Dynamically Setting Slugs with Multiple Path Segments in url (/some/thing/here)

I’ve been playing with the new slug features and came up a with a nice way to dynamically generate URL path segments such as your.url/some/thing/here

This is pretty handy SEO or various landing pages that you might want to have more easily readable but also unique, ie /team for the first and /team-1 for the second etc.

  1. The first thing you’ll want to do is set the slugs for each of your types of content. I usually do this on pageload, and check if it’s already been created. You could also do this if the name is changed.
    image

  2. Since you can’t dynamically set your page’s “Type of content” dynamically, you’ll want to create a page state to store the value from your path segment. You can do this for all your various path parameters. (replace #3 with the path segment /1/2/3/4 etc)

Now you can get your URL paths like this
image

You’ll need to link to your page via an external website action.
image

** There is a small bug when doing this, for some reason, onload events on reusable elements don’t seem to work. I’ll probably file a bug report on this.

3 Likes

Not sure why this thread hasn’t gotten more attention. Super insightful tip. Thanks so much for sharing!

1 Like