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

include external links within the content #34

Open
madeleine68 opened this issue Jun 22, 2022 · 2 comments
Open

include external links within the content #34

madeleine68 opened this issue Jun 22, 2022 · 2 comments

Comments

@madeleine68
Copy link

I want to embed some links in my posts. Graphcms allows me to include links, but they do not display on my website. I appreciate any suggestions you may have.

@JoBaHP
Copy link

JoBaHP commented Jun 22, 2022

I used rich text renderer. Just follow their doc.

@Scavengah
Copy link

I'm having trouble with this too. I've tried the rich-text-renderer but can't get it to work with the existing code. Feel like it should be rather simple. I think JSM mentioned it in the video, like something you could do swiftly, if you felt like it.

Tried building something referencing this code, but can't get it to work:


[REPLY]
Ícaro Teles
youtube.com/channel/UCSQET804y4VUVqMmk2FpS9A

youtube.com/watch?v=HYv55DhgTuA&lc=Ugx7_LaGcjQAIEQEGCp4AaABAg.9dOrmIWz2M09eEAuJF_V3e
for 3 måneder siden | like: 1

If I may, you should modify the "getContentFragment" function of the "PostDetail" component to encompass more cases, in addition to the ones it has already placed. For example, in the video he considers cases with "bold", "italic", "underline", "h4", "h3", "p" and "image". You should extend it, depending on your need.

For an example, I added a case for "block-quote", like this:

 case "block-quote":
        return(
          <blockquote key={index} className="text-md mb-4">
            {modifiedText.map((item, i) => (
              <React.Fragment key={i}>"{item}"</React.Fragment>
            ))}
          </blockquote>
        );

This case I added in the switch, considering that my blockquote would be like a block tag. If it's an inline tag, like the tag, you should add an if check before the switch.

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

3 participants