Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENTRY_HYPERLINK in gatsby-source-contentful/rich-text #268

Open
AhmedAbdulrahman opened this issue Sep 15, 2021 · 3 comments
Open

ENTRY_HYPERLINK in gatsby-source-contentful/rich-text #268

AhmedAbdulrahman opened this issue Sep 15, 2021 · 3 comments

Comments

@AhmedAbdulrahman
Copy link

Hi, I did attempted to find a solution for my case but could not. so thought would be good to share here.

we have an old gatsby project, I upgraded all pages and resolve issues that I got, except INILINE_ENTRY_HYPERLINK that uses an exsiting document in rich text but wont render its conent.

Here is how it was handle with old code:

[INLINES.ENTRY_HYPERLINK]: (node: any, children: any) => {
  let slug = node.data.target.fields.slug['sv-SE']
  const url = formatUrl(data, slug)
  return (
    <Link className="Link" to={`${slug}`}>
      {children}
    </Link>
  )
},

However, after I upgraded old packages I can't get that target.fields in node. This is what we have in data:

{
  "data": {
    "target": {
      "sys": {
        "id": "6o3XQvgXhttg99sTnKUCJd",
        "type": "Link",
        "linkType": "Entry"
      }
    }
  },
  "content": [
    {
      "data": {},
      "marks": [],
      "value": "bli medlem",
      "nodeType": "text"
    }
  ],
  "nodeType": "entry-hyperlink"
}

How can I access the files property?

@gugu8181
Copy link

Hi

@rutgerbakker95
Copy link

@AhmedAbdulrahman Hi Ahmed,

Did you find a solution for this? I'm facing the same problem #346

@lancegliser
Copy link

lancegliser commented Jan 11, 2024

This seems to be working for me in React.

    [INLINES.HYPERLINK]: (node, children) => (
      <Link href={node.data.uri}>{children}</Link>
    ),

Ah, you're working with an Entry link. I've not encountered yet. So sorry! I'll stay subscribed in the hope we're all corrected or I get there first.

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

No branches or pull requests

4 participants