project_graphql_blog icon indicating copy to clipboard operation
project_graphql_blog copied to clipboard

include external links within the content

Open madeleine68 opened this issue 2 years ago • 2 comments

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.

madeleine68 avatar Jun 22 '22 13:06 madeleine68

I used rich text renderer. Just follow their doc.

JoBaHP avatar Jun 22 '22 16:06 JoBaHP

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.

Scavengah avatar Nov 14 '22 20:11 Scavengah