Page as a reusable element - get data from url

Looking for advice on how to best go about this…

My app will have multiple pages that all have the same structure but the data contained in each page will be different (similar to profile pages on other apps).

I want to structure the URLs so it’s something like fakesite.com/resource1 and that page gets populated based on the data available for resource1. And then have similar pages for resource2, resource3, and so on.

I started building this out and realized I was doing it in a manual way, ie, on the resource1 page I would set all the data to match resource1 - such as “title = resource1’s display”. But then when I go ahead and make the page for resource2, I’d need to set it all manually again.

Currently, each resource is an option with various attributes. I’m wondering if there’s a way for me to only manually create the page url, ie, fakesite.com/resource1, and then have the ‘resource1’ part of the url tell the rest of the page which data should be displayed.

Or, is there a better way to create multiple pages that all have the same structure, but with different data. Initially I started to just clone the pages but realized that will make updates cumbersome in the future.

Sure, but you won’t be able to use that URL structure…

(I assume you’re talking specifically about data from an option set here, not from the database)

You’ll have to create a page, then use URL paths to define the option from your option set.

So your URL would look like www.mysite.com/mypage/myoption

Then just use Get Data from URL, select path, and set the ‘type’ to the option set (note, this will only work using the option’s Display - and I’m not sure off the top of my head how it works with spaces and special characters - you’ll have to check that for yourself).

Then you can simply refer the the Option set (via the URL path) in all your on-page data - probably best to set it as a custom state value on page load, or have a group on the page with the option as it’s content type and data source as Get Data From URL, then just refer to that throughout the page.

Hey @thatlazyguac

In addition to what @adamhholmes said. Maybe using a dataType would be the better way to go. It’s hard to know unless we know more about your project.

As a review, you can’t update option sets through workflows. If you update an option set, you would have to push to live for the update to be seen.

DataTypes can be updated and created through workflows. If you are using a dataType, if you update it in the live database, it’s instantly changed. No ‘push to live’ needed.

Does that make sense?

1 Like

Appreciate the responses - very helpful. I’ll probably need to do a bit more learning and experimenting as I’m not completely sure the best way to get things to work how I’m imagining.

Currently, I’m using an option set with various attributes for static data that won’t change. But, I also have data that changes when users ask and answer questions - and one of the fields is a list of options which I use to tag the user added content.

Ie, resource1 is an option that has several static attributes such as Link, Description, Logo, etc. Then there’s a question data type which includes various fields, one of which is the resource1 option.

The thought here was to allow users to tag content added with the appropriate option, that way it’d be easy to filter and display on the appropriate pages. Not sure if the way I’m going about it makes much sense or not (and this rambling comment probably doesn’t make much sense either).