Pages Navigator Custom Preview Issue
jckhxn opened this issue · comments
When attempting to customize the information returned by the pages navigator, I get the UUID (i.e pathname.current) instead of the value I'm attempting to return (which would be youtube.title in my schema)
How I'm customizing my preview
select: { title: "youtube.title", seasonNumber: "youtube.seasonNumber", episodeNumber: "youtube.episodeNumber", }, prepare(selection: { title: any; seasonNumber: any; episodeNumber: any }) { const { title, seasonNumber, episodeNumber } = selection; return { title: title, subtitle:
S${seasonNumber} E${episodeNumber}, }; }, },
Upon investigation it is still returning the default value which is the pathname value.
Any suggestions? Thanks in advance.
Thanks for such a fantastic set of tools here!
I second this comment. When settings the name of the 'pathname' field to anything different (eg definePathname({ name: 'slug' })
), the page navigator and "create new page" doesn't pick it up, instead defaulting to pathname
. Could there be a setting in sanity.config.js that allows us to set this value? I'm trying to make this work in a pre-existing dataset :)
![Screenshot 2024-05-09 at 2 54 03 PM](https://private-user-images.githubusercontent.com/27719652/329130642-bab2ee58-0ec4-4f32-a84c-eb95a45c4b80.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2OTA5NDksIm5iZiI6MTcyMzY5MDY0OSwicGF0aCI6Ii8yNzcxOTY1Mi8zMjkxMzA2NDItYmFiMmVlNTgtMGVjNC00ZjMyLWE4NGMtZWI5NWE0NWM0YjgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE1VDAyNTcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk1YmI4NzRkZTk5ODVjZmEwODI0N2Q5Njc5MjAwNGNiMGMwZWM5NWM4MTdlMGQ5OWFjZjA3ZTVmNjFmYTc3YzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PqQZBbvAzvze2nerjsHODAu1-brFIsK96Tb4rE5Pg74)
![Screenshot 2024-05-09 at 2 54 09 PM](https://private-user-images.githubusercontent.com/27719652/329130654-f4578b56-2297-4e54-acfe-1bf9c11fe5f5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2OTA5NDksIm5iZiI6MTcyMzY5MDY0OSwicGF0aCI6Ii8yNzcxOTY1Mi8zMjkxMzA2NTQtZjQ1NzhiNTYtMjI5Ny00ZTU0LWFjZmUtMWJmOWMxMWZlNWY1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE1VDAyNTcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmODIwZDBjOGIzOGJmYTBkOThiODliMjQyZDJhM2E2MzZiOTc4MGQ2MzZmNmM0ZGFlMjU3NDJiMjk2YzdkMDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Wh6d71ihNF7SOaQT0xE-kKrl6eRJA4L7zKmk0neyC7c)
![Screenshot 2024-05-09 at 2 54 13 PM](https://private-user-images.githubusercontent.com/27719652/329130658-ba4bd42f-7592-473a-9642-b8d0b8aa3614.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2OTA5NDksIm5iZiI6MTcyMzY5MDY0OSwicGF0aCI6Ii8yNzcxOTY1Mi8zMjkxMzA2NTgtYmE0YmQ0MmYtNzU5Mi00NzNhLTk2NDItYjhkMGI4YWEzNjE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE1VDAyNTcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRkNjRlMzA4OTM5MWU3YjYzMGM4Y2EzYWU0M2JjZDRiMzFiNDExMDZkNjZmNTM5M2M2OGRkZmQ1OWYyODE0ZGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cMGVFCZxIx_abAVloawFnOsjLpUvFpiJm0LZXVSAr44)
Any help would be much appreciated!
Any help would be much appreciated!
I have applied the same line in my schema, removing the field, then setting the URL. My document then had the field "slug". In your example you are only overwriting the existing pathname field from before. Hope that helps!