Missing documentation of Content Preview

Hi!

I can’t find any official information about how Content Preview works.
Can someone explain the basic concept of this feature?

I want to use it in a Nuxt/Vue project, so a similar approach in the explanation would be much appreciated.

Thanks in advance!

see How does Content Preview work? · Issue #782 · agentejo/cockpit · GitHub

1 Like

I recently got it working with Nuxt using the following mounted() call for a specific route (/blog/_slug):

mounted() {
  if (this.slug === 'preview') {
    let $this = this;

    if (process.client) window.addEventListener('message', function(event) {
      $this.post = event.data.entry;
    }, false);
  }
}

I tried working with the Nuxt previewMode but this will only try to load new data via the asyncData() hook which in return should call your API so this won’t work with Cockpits Content Preview.

1 Like