Giter Site home page Giter Site logo

Comments (12)

billyryanwill avatar billyryanwill commented on September 27, 2024 1

Is there anything that can be done on this? Happy to help contribute if there's a plan of action. I've been looking at how to resolve these the last few days and I'm sure it's something that will help the community loads.

from gatsby-starter.

petrsvihlik avatar petrsvihlik commented on September 27, 2024 1

@billyryanwill thanks for your interest! we'll be happy to work with you on this one.

@Simply007 can you please suggest a solution? thx

from gatsby-starter.

billyryanwill avatar billyryanwill commented on September 27, 2024 1

Just realised I commented using my other Github account 😂 rest assured it's the same dev!

from gatsby-starter.

Simply007 avatar Simply007 commented on September 27, 2024

Hello @billyryanwill,

thanks for your interest. If you provide me an email you are using for the Kentico Cloud I can clone you the source project we are using for the starter so that you could make the changes there. And once you are ready to contribute, I could merge the changes back to the source project.

The best way to demonstrate the rich text resolution is on type Blogpost reference on Summary field (as it is in the description). We already have a blog post with a description of how to resolve linked items in rich text element and I think it would be great to have this approach incorporated in the starter for inline linked content items.

There are also showcases how to load the content in the source plugin Readme.

FYI: content components resolution showcase is submitted in #28.

from gatsby-starter.

billyryanwilliams avatar billyryanwilliams commented on September 27, 2024

@Simply007
So I took a look at that pretty awesome blog post. Looking at it it made sense to abstract away a bunch of the internals and make it more accessible. I've just released a really early version of what that package could look like here.

Effectively I've taken a load of the internals from the blog post and added them to an ES6 class to make the code a bit more maintainable. Then exported a Gatsby component which takes in a function to spit out the actual components you want to use. See below for a rough example.

import RichText from "kenticocloudgatsbyresolver";
<RichText 
  content={yourModel.resolvedHtml}
  contentItems={yourModel.linked_items}
  customLinkedItemRenderer={
    function({type, linkedItem}){
      switch (type) {
        case 'snippet': {
          return <CodeBlock linkedItem={linkedItem} />;
        }
        default:
          return "Unsupported type";
      }
    }
  }
/>

The cool thing about this is that we can add in the inline link and image resolvers into this rich text component as well with minor amounts of work.

This is definitely the direction I'm going to go in for my projects. What are your thoughts on using this?

from gatsby-starter.

Simply007 avatar Simply007 commented on September 27, 2024

@billyryanwill (aka @billyryanwilliams),

that is great. Let's ping the author of the blog post @rshackleton, maybe he has also some thoughts using this.

I think that approach is great and it proved to be useful (https://rshackleton.co.uk used this I believe) I am deciding whether it suits to this "simple starter" that was meant to be a more bootstrap project, but on the other hand, most of the people are using rich text element. So let's try it - we could always split this example to another repository.

Just FYI:
We also have one Gatsby Template project but it is also just a landing page if you want to take a look.

from gatsby-starter.

Simply007 avatar Simply007 commented on September 27, 2024

Related to billyryanwilliams/kenticocloudgatsbyresolver#3

from gatsby-starter.

rshackleton avatar rshackleton commented on September 27, 2024

Somehow I think I'd managed to miss this since last August 😳

@billyryanwill I'll take a closer look at the implementation, it could be worth merging into the Gatsby theme package I've started as resolving linked items a common requirement and would be something that most projects would require.

https://github.com/rshackleton/gatsby-packages/tree/master/packages/gatsby-theme-kontent

from gatsby-starter.

billyryanwilliams avatar billyryanwilliams commented on September 27, 2024

@rshackleton 😂

No worries. I'm going to look at updating it with what is currently there and pointing and using the Kontent packages instead so that at least it is up to date.

I'd be keen to potentially keep it as a separate package so that it's relatively easy to import without using the theme? What do you think?

cc @Simply007

from gatsby-starter.

rshackleton avatar rshackleton commented on September 27, 2024

Can absolutely still be separate, I may just make it a dependency of the theme.

from gatsby-starter.

billyryanwilliams avatar billyryanwilliams commented on September 27, 2024

Cool. I've got some time this evening so will try and port it over.

@Simply007 I'm guessing me rebranding it with Kontent rather than cloud in the name is preferable? If so I'll spin up a new package.

from gatsby-starter.

Simply007 avatar Simply007 commented on September 27, 2024

@billyryanwill - yes it is.
We have these internal naming conventions, you could follow them if you want.

from gatsby-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.