storyblok / gatsby-source-storyblok

Gatsby source plugin for building websites using the Storyblok headless CMS as a data source.
MIT License
43 stars 35 forks source link

Resolve Links in Editor.js #36

Closed aidenBarrett96 closed 1 year ago

aidenBarrett96 commented 4 years ago

I am trying to get all data about a linked story but only get the overview data (uuid, cached_url). Is there a way to resolve links with the Storyblok bridge to get this type of data into the visual editor.

tlambrou commented 3 years ago

@aidenBarrett96 you should be able to achieve this by passing resolve_links into the requests in editor.js. The resolveLinks key is only for gatsby-source-storyblok config.

  loadStory(payload) {
    const path = window.storyblok.getParam('path')
    window.storyblok.get(
      {
        slug: path,
        version: 'draft',
        resolve_links: sbConfig.options.resolveLinks || 'url',
        resolve_relations: sbConfig.options.resolveRelations || [],
      },
      (data) => {
        this.setState({ story: data.story })
      }
    )
  }

https://www.storyblok.com/docs/api/content-delivery#core-resources/stories/retrieve-multiple-stories

iamfortune commented 1 year ago

Hi @aidenBarrett96, I will be closing this issue, feel free to open it in the future if you need to.