Skip to content
Product Documentation

How to display stories by a given author, accounting for name changes

Authors can change their name for many reasons. When setting up features and templates in PageBuilder that render author data or stories written by an author, this possibility of name change should be taken into account. There are certain fields you will want to update with the name change, and others that need to stay static so that content queries return stories before and after a name change.

In the Author API, there are two fields that are relevant here: _id and slug. The difference is that _id is fixed (it cannot be changed), but slug is not fixed (it can be regenerated). So if an author changes their name, the slug can be changed to reflect that, while the _id remains the same.

For that reason, some orgs prefer to expose slug in URLs, so that the author’s bio page URL can change if their name changes. But _id is safer for querying the Content API, because if a query was built using slug, and the slug changes, then the query won’t find content anymore - while if the _id is used for querying, content will be found before and after an author changes their name.

Example Author

Let’s say we have an author named Taylor Doe. Here’s their Author Service entry:

Author Entry

{
"_id": "taylordoe",
"firstName": "Taylor",
"lastName": "Doe",
"byline": "Taylor Doe",
"slug": "taylor-doe"
}

If Taylor changes their name to Taylor Doe Smith, then any relevant field (including slug) can be manually updated in the Author Service app to include this. However, _id will not change.

{
"_id": "taylordoe",
"firstName": "Taylor",
"lastName": "Doe Smith",
"byline": "Taylor Doe Smith",
"slug": "taylor-doe-smith"
}

How to create a query for an author’s stories

If you want to set up a static query for a single author (for instance, you want to feature specifically Taylor’s columns on the homepage), then you should query the Content API by the Author’s _id

This way, the query will still return stories before and after Taylor changes their name.

Following Content API Documentation, you could find the 10 most recent stories by Taylor by using this query:

https://api.[ORG].arcpublishing.com/content/v4/search/published?website=[WEBSITE]&q=type:story+AND+credits.by._id:taylordoe&sort=display_date:desc&size=10

If you had instead queried for:

type:story+AND+credits.by.slug:taylor-doe

Then when Taylor changes their name to Taylor Doe Smith, your query would no longer find their stories (because the slug is now taylor-doe-smith), so the feature would appear empty (no stories will be displayed).

How to set up a resolver + template for Author Bio pages

If you want your Author Bio pages to include the author’s slug in their URL (that is, you want author bio pages to have a human-readable URL like www.Example.Com/Authors/Jane-Doe/) instead of using an _id like www.example.com/Authors/Taylordoe/, then you should utilize the slug field to get information about the author from the Author API.

If you wish to utilize slug in the URL pattern for these pages, you should do the following:

  1. Ensure that Slug is enabled as an editable field in your Author Service app (it is disabled by default). If you do not see a Slug field in your Author Service, can request this through Arc Support.

  2. When readers click the byline of your authors (e.g. on an article page, to see more stories written by them), ensure that the URL is created by using the slug - e.g. /authors/{slug}/ - note that authors can be any string you want (e.g. people or staff), as long as you’re consistent and set up the same pattern in the resolver.

  3. In PageBuilder, you should have a Content Source to Look Up Authors In The Author API By Slug, e.g.:

https://api.[ORG].arcpublishing.com/author/v2/author-service/?slug=taylor-doe-smith
  1. The resolver you set in PageBuilder for the Author Bio template should:

    a. Capture the slug from the incoming URL

    b. Use the Author API by Slug Content Source, and send that slug to it

    Author Entry

  2. Because of how this resolver is configured, the global content of your Author Bio template is the Author API response:

    a. The Author Bio feature can inherit directly from that global content (since it contains all of the Author Service data you need to display about that author):

    b. While the feed feature can utilize the global content’s _id value to query the Content API by the author’s ID, using curly braces syntax, i.e. {{content._id}}:

    Now, if Taylor changes their name to Taylor Doe Smith, their slug can be updated to taylor-doe-smith (and because of the nature of author references on stories, this will update on every story Taylor has published in the past). When users click on their name, they’ll be directed to /author/taylor-doe-smith/ and the resolver will capture taylor-doe-smith and request for that slug’s data from the Author API.