How to access a Slug custom field and place it directly into a link href? Answered
Does anyone know how I might access a “Slug” custom field and then place it directly as the href to a link? Basically I have a site where members are able to create user pages for themselves, and when a user is logged in, i want there to be a link to “view public profile” the address of which is stored as a slug custom field. I know I can access the custom field using data-ms-member=“slug” - my question is: is there a quick way of putting the result of that attribute straight into the href of a link? (I know I can do this with JS - I just wondered if there is a more elegant solution)
Thanks.
Comments
3 comments
Hey Karina Finegan - I think there are a few ways to do this. The easiest might be the following: you should have a "Members"/"Users" template page that gets created for every member/user of your site. Depending on how your site is set up, you should be able to link to that page using the "current collection item" attribute within Webflow's UI. You'll need to make sure you have your permissions set up right, but setting these pages to public will achieve the result you want.
We also have a MemberScript for this https://www.memberstack.com/scripts/populate-link-from-custom-field
Duncan from Memberstack Thanks Duncan, that’s exactly what I needed. Saves me using hidden inputs on the page.
Please sign in to leave a comment.