@builder.io/plugin-preview-logic

0.0.3-0 • Public • Published

Builder.io Preview Logic plugin

This plugin allow advanced computation of the preview url inside Builder's editor, useful for cases where you have a special routing logic in your preview site based on the content custom fields or targeting attributes, for example routing based on locales.

Installation

Go to builder.io/account/space and type @builder.io/plugin-preview-logic in the text input, then hit save.

Installation screenshot

After hitting save, the app will reload with the plugin code installed,

Now from the same menu, hit edit plugin settings

Plugin Settings screenshot

Add a preview setting by hitting + preview setting

Pick the model you'd like to add the preview setting to

Model picker screenshot

Write the code you'd like to run to compute the preview url, in this code you'll have access to three objects:

  • content: a json representation fo the current state of content, access properties directly for example: content.data.title
  • space: the space settings: siteUrl, name, publicKey
  • targeting an object represeting the content targeting settings, for example: targeting.urlPath

Always return a string representing the final preview URL you'd like the app to use.

Readme

Keywords

none

Package Sidebar

Install

npm i @builder.io/plugin-preview-logic

Weekly Downloads

2

Version

0.0.3-0

License

MIT

Unpacked Size

1.53 MB

Total Files

5

Last publish

Collaborators

  • harmeet.builder
  • armela
  • strd6
  • murtaza-haveliwala
  • gustavohgs
  • sanyamkamat
  • shyam-builder
  • manucorporat
  • steve8708
  • samijaber
  • caleb.amsden
  • teleaziz123
  • mrkoreye
  • mhevery
  • adamdbradley