✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Internal links in a v2 project suddenly stopped working, but the issue was fixed by updating the query.

4 replies
Last updated: Sep 27, 2023
Ello! I have an old v2 project, suddenly my internal links stopped working, like over night. Has anyone encountered this before? Havent touched the project in months so its a bit weird. I will stick some more info in thread.
Sep 26, 2023, 6:50 AM
internalLink: (props: any) => {
      console.log('props : ', props);
      return (
        <ArticleLink type={ArticleLinkType.Internal} href={'#'}>
log of props:

props :  {
  node: {
    _key: '835e9c573f05',
    reference: {
      _ref: '18124180-6ce3-4b31-b12e-bf9ad911bf26',
      _type: 'reference'
    _type: 'internalLink',
    text: 'interal'

groq`*[_type == "article" && content.slug.current == $slug][0]{
            "media": ${groqFormatMedia('media')},
            body[] {
                @._type == "fileLink" => @ {
                    "url": asset->url,
Sep 26, 2023, 8:00 AM
By ‘stopped working’ do you mean you get an error or does it not render at all?
Sep 26, 2023, 3:35 PM
Sorry, it applied its own slug to the href. A new query fixed it.
Sep 27, 2023, 6:29 AM
Thanks for updating us!
Sep 27, 2023, 3:56 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?