Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

internal link not working #54

Open
Aurel-Kadiu opened this issue May 9, 2021 · 2 comments
Open

internal link not working #54

Aurel-Kadiu opened this issue May 9, 2021 · 2 comments

Comments

@Aurel-Kadiu
Copy link

i have the default configuration for internal link on the simple block content , external link are working finr but on the intrnal link are render oas span only.

@brownbike
Copy link

Is there any news on this? I'm running into the same thing. The Internal likes aren't serializing correctly.

@Aurel-Kadiu
Copy link
Author

Hi @ALL try this solution, for me is working

//pages/[slug],js

const pageFragment = groq`
...,
content[] {
  ...,
   text[]{
      ...,
      markDefs[]{
        ...,
        _type == "internalLink" => {
          ...,
          "slug": @->slug
        }
      }
    },
  cta {
    ...,
    route->
  },
  ctas[] {
    ...,
    route->
  }
}`

//serializers/InternalLink.jsx

import React from 'react'

export default function InternalLink(props) {
    const { text, value: { slug } } = props

    return <a href={slug && slug.current}>{text}</a>
}


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants