Skip to content

Clarify that the SEO tabbedUI option checks for the first field after any plugins that appear before it run #12355

Open
@evelynhathaway

Description

@evelynhathaway

Documentation Issue

This section of the SEO plugin documentation could potentially be improved to warn about plugins that run before the SEO plugin adding hidden fields, causing two sets of tabs.

If your collection is not already tab-enabled, meaning the first field in your config is not of type tabs, then one will be created for you called Content.

From SEO plugin - tabbedUI

It may be a good idea to nudge developers to check their plugin order if the tabbedUI logic cannot be updated to skip hidden fields or perform a quick field search at the root level. Including or linking to the tab field order limitation from the JSDoc would also be beneficial.

Additional Details

Using the first party multi tenant plugin before the SEO plugin causes a hidden tenant field to be added to the start of that collection's field config.

export default buildConfig({
  // [...]
  plugins: [
    multiTenantPlugin({
      collections: {
        pages: {},
      },
    }),
    seoPlugin({
      tabbedUI: true,
      collections: ["pages"],
    }),
  ],
});

Which is a minor head scratcher since the tenant field is hidden from the UI and of course not in your collection config source code. The JSDoc for tabbedUI doesn't even mention the limitation, and instead lead to me believe that possibly something changed and I needed to use the direct field escape hatch. Luckily I reread the documentation for tabbedUI, but it also didn't immediately clue me in to this interaction.

The fix for me was simple and prefered over the direct fields, changing the order of the plugins in the config.

export default buildConfig({
  // [...]
  plugins: [
    seoPlugin({
      tabbedUI: true,
      collections: ["pages"],
    }),
    multiTenantPlugin({
      collections: {
        pages: {},
      },
    }),
  ],
});

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions