Skip to main content

Configuring resolvers

Use the Resolvers page on PageBuilder Editor's Developer Tools to specify which template appears on your site's pages.

Each resolver contains a URL pattern (a regular expression) that maps to a content service and a specific template when matched.

If multiple resolvers match the same URL pattern, PageBuilder uses the one with the highest priority (lowest number). Optionally, you can include query parameters with your resolvers to work with the content service or enable content-mapped templates. This allows you to select templates conditionally based on values returned by the content service.

When a reader clicks a link on your site, PageBuilder receives the HTTP request and parses the URL. If the URL matches one of your resolver configurations, PageBuilder validates the request parameters and renders the corresponding template.

When a user navigates to a URL on your site, resolvers follow these steps to determine which template to display:

  1. Match the URL - the resolver checks if the URL matches its defined pattern. For example, the pattern ^(/([0-9]{4}/[0-9]{2}/[0-9]{2}/[\w\-]+)/ matches URLs formatted as /2019/12/04/0-creating-your-first-site-feature/. If the URL matches, the resolver proceeds to the next step. If not, it attempts to match the next configuration.

  2. Verify Required Parameters - the resolver confirms that the URL contains all required parameters and that these parameters match their respective regular expressions. If all required parameters are present and valid, the resolver selects the corresponding template. Otherwise, PageBuilder attempts to match against the next highest priority resolver.

    Optional query parameters don't need to be present for the request to proceed. If you've defined optional parameters with default values, like published=true, PageBuilder uses these defaults when the parameters aren't explicitly provided in the request.

  3. Handle No Matches - if the URL doesn't match any resolver configurations, PageBuilder returns a 404 status code to indicate the page wasn't found.

Prerequisites

To create a resolver, you must have created at least one template and configured one content source. For more details, see Configuring templates and Content source blocks in Outbound Feeds.

As an administrator of your organization, you want to create author bio pages that display information and article feeds for your writers.

Before creating this resolver, you must enable the slug field in the Author Service application to ensure proper author identification.

Then, you create a resolver that captures the author's slug from URLs formatted as /author/{slug}/, connects to the Author API content source to retrieve author information, and maps to your author bio template.

You set a priority of 6, typical for author resolvers, and configure it to work across all websites in your organization.

After the resolver is in place, users navigating your site can click on author bylines to view detailed bio pages, see an organized feed of articles written by that specific author, and access author content even if the author changes their name, as the slug-based resolver maintains proper linking.

Procedures

To create a resolver, if in a multi-site organization, you must first select the website where you want to use the resolver from the left Filter Website panel. Then, complete the following steps:

  1. Navigate to PageBuilder Editor > Developer Tools > Resolvers. The Resolver Configurations page opens.

  2. Click New Resolver. The Create Resolver window opens.

  3. Enter the following details:

    • Resolver Name - set a descriptive name for the resolver, for example, Author resolver.

    • Resolver Priority - enter a number that represents the resolver's importance, where 1 is the highest priority and 99 is the lowest. If two patterns match the same URL, the system selects the template with the highest priority.

    • Resolver note - set a note that helps other users know what this resolver does.

    • Regex Pattern - type the regular expression that matches the URLs for which you want to use the template. Use parentheses to identify the matched text to send to your article’s content source.

    • URL Parameter- click Add Parameter to enter optional query parameters to send with your request to the content service. By default, parameters are optional. For example, you can create an optional parameter of "published" with the default value of "true". If the query parameter is not provided in the request, PageBuilder fetches content using the default value.

      Mark the checkbox to make the parameter required if you want to ensure the parameter must be present for the resolver to match.

      Use the delete icon icon_delete_task.png to remove a query parameter.

    • Websites - click the drop-down menu and choose websites where your resolvers apply.

    • Content Source - choose the content service that provides the content that the template can render.

    • Default Template - choose the name of the template.

    • Default output type - optionally, choose the default output type for this resolver.

    • Content Mapped Template - See Creating a content mapped template for more details.

  4. Click Save.

The resolver becomes available in the Resolver Configurations page.

Content mapped templates allow a finer template resolution based on top-level fields returned by the content source. For example, a request to a gallery URL /images/yyyy/mm/dd can be mapped to a single resolver configuration but may require different templates to display images based on their content.

The content source may append top-level key/value fields, for example, img-size : small. You can map these field names and values to different templates.

To create a content mapped template complete the following:

  1. Navigate to PageBuilder Editor > Developer Tools > Resolvers. The Resolver Configurations page opens.

  2. Create a resolver following the Creating a resolver procedure.

  3. When you get to the Content Mapped Template field:

    1. Enter the top-level field the system uses to determine the correct template, for example, subtype.

      1. Enter the Mapped Value, for example, no-sidebar.

      2. Choose a Template, for example, article-full-width.

    2. Click the plus icon to add these value pairs as needed. Field values should correspond to the proper, valid, and possible values returned by the content source.

  4. Click Save.

To edit a resolver, complete the following:

  1. Navigate to PageBuilder Editor > Developer Tools > Resolvers. The Resolver Configurations page opens.

  2. Click the ellipsis icon icon_ellipsis.png ne your desired resolver. A contextual menu shows.

  3. Click Edit. The resolver configuration window opens.

  4. Edit the resolver details as needed.

  5. Click Update.

The updated resolver is available in the main Resolvers Configurations page.

To delete a resolver configuration, complete the following:

  1. Navigate to PageBuilder Editor > Developer Tools > Resolvers. The Resolver Configurations page opens.

  2. Click the ellipsis icon icon_ellipsis.png ne your desired resolver. A contextual menu shows.

  3. Click Delete. The Deleting resolver confirmation message appears.

  4. Click Delete Resolver. A green deleting notification appears at the bottom of the page.

The deleted resolver is no longer available in the Resolvers Configuration page.