Article Author for a Blog

Hi all,

I am creating a blog and there will be 1 or more authors.

What's the best practice for storing and fetching author's names + photos?

Would you create a custom type for authors? Or is it possible to pull the built-in author data?

Thank you,

Ivan

Hello Ivan, welcome to the community forum!

It is not possible to pull the built-in author data; and yes, creating a unique Custom type for authors would be the best way to do it. Read how to create a Custom Tagging System.

2 Likes

Hi Ivan,
Yes, we have used the guideline for a tagging system. Created an “Author” type.
All the fields are in the main section (did not use slices). Then in the “Blog” type created a field called Author with “Content Relationship” of Author type. Then add each author as a new document and publish. Two things I am keen to highlight:

  • Add the new Author type in config file (in our case gatsby-config) schemas section
  • Add the new Author .json to the schemas section of project (eg in gatsby)
    Hope that helps. This has enabled us to add multiple authors.

Thank you Paulina and MolimiEd - this helps!

I'm not sure how it works in gatsby but with the setup you described (flat fields in primary) using fetch_links will let you prefetch the author of a document in our blog we use this in our options:

fetchLinks: ['author.name', 'author.picture', 'category.category']

As you can see we also have a category custom type which creates the categories for our blog and we prefetch that. the tags within prismic are only used for editors to organize the content from the editors perspective.

1 Like

This issue has been closed due to inactivity.