Priority of empty target vs url-target for structured data

Builder content link

Builder public api key
eedb016ed0f24811aa21758b098fbb71

What are you trying to accomplish
We have a set of similar pages. We want to be able to specify content per page and at the same time to have a default content specified in the builder.

Scenario:

Open the page “/usa”. Content managers have setup this page. Title should be “Welcome to USA”
Open the page “/canda”. Content managers didn’t setup this page, but they’ve set up default content. Title should be “Welcome to Earth”.

How we did approach this:

Two structured data publications created

  1. Target is empty, data is “Welcome to Earth”
  2. Target is “Url path is /usa”, data is “Welcome to USA”

Component calls builder.get(‘page-title’, { url: window.location.pathname }).promise()

Idea is that if there is a publication with specific target url, it will be fetched. Otherwise “Default” publication with empty target will be fetched.

Usually it works exactly like this. But some times “Default” content" is fetched. Seems to be url specific. For some urls publication with empty target is fetched, for others - with filled target

Can you please explain how priorities work and how we should approach this problem?

Code stack you are integrating Builder with
NextJS, Server fetching

Hello @Kirill,

When you have multiple versions of a content entry, Builder uses specific criteria to determine which content entry to deliver.

The criteria that Builder uses to choose the content entry to deliver are:

  1. The content entries must be published; if they are scheduled, their scheduled publication must include the current date and time.
  2. Any targeting attributes must be met.
  3. Builder starts evaluating from the top of the content list. If two published content entries both meet the first two criteria, Builder chooses the one that comes first in the list.

You can refer to the following link to know more Scheduling Content - Builder.io

The best to resolve this would be to use targeting on both contents i.e. Instead of setting it empty, set the target to ‘/canada’ or ‘/world’ and target accordingly, give this a try and let us know if this works for you.

Thanks,

Thank you!

We want to have non-targeted content for a reason. We have more than 200 pages. It is the best if we have some fallback for pages that wasn’t setup by content managers for some reason. And it’s great to be able to edit this fallback content within builder

Sound like your 3rd point solves the issue for us. Did I understand correctly, that we can drag’n’drop the non-targeting publication down the list and it will has the lowest priority?

Hello @Kirill,

That’s right, you can drag’n’drop the non-targeting publication down the list and it will have the lowest priority.

Thank you, it worked!