How to Handle Previews in a Headless Architecture

Hey @byebyers

Good question. The live preview button shows on the article collection only because of this snippet:

//  ./src/plugins/previewbtn/admin/src/components/PreviewLink/index.js
const PreviewLink = () => {
  const {initialData} = useCMEditViewDataManager();
  if (!initialData.slug) {
    return null;
  }

It’s a simple trick to filter collections based on the slug field. In essence, if a collection you create in your Strapi Admin Dashboard has a slug field, the Preview button
will show up. So in your case, I can guess that the Locations collection has a slug field and the Menus collection doesn’t.

1 Like