#How do get document data within Collection custom component?

14 messages · Page 1 of 1 (latest)

frank solar
#

I'm trying to create a "view page" button using a UI field within the relevant collection and I'm not sure how I'm supposed to get any of the document data I need to generate the URL

sage ocean
#

@frank solar You should be able to use Hooks to get document data

frank solar
#

Specifically I need the doc's slug and the id of the category it is related to so I can fetch that category and generate the URL since the URL structure is https://mywebsite/category/slug

sage ocean
#

You only got the slug back?

#

Can I check out your usage of the hook?

frank solar
#

No I got a bunch of other values, but, none of them looked like it would give me what I needed, kinda wish the docuementation explained what some of the values are

sage ocean
#

I can review it with you if you post the returned value here

frank solar
#

Oh on second glance it may be the initialData, if not I can post the returned value, let me test this real quick though

sage ocean
#

Sure thing

frank solar
#

Yup, the initialData gets me the docs fields and values, this is what I needed I apologize for not seeing this value during my first pass and making a post about it lol