Polymorphic "resources" whilst maintaining a good authoring experience

Hello,

  • We currently have a blog. It has the traditional setup of a Post that can have an Author and a Category. These are ordered by a publish date on a Post
  • We would like to change this blog to a resources section. By that, I mean that a Post might be one type of resource. Other types might be an eBook, a Podcast, a Tool etc. An example would be the resources page at HubSpot | Business and Marketing Resources.
  • My immediate thought is that these are different custom types as the fields required and how they present are going to be different - and presenting non-relevant / non-applicable fields to a hypothetical 'resource type' isn't a great experience for the authors.
    • This presents a problem, because as far as I understand, there isn't a way to do a union type / paginate across these multiple types using Gatsby (this is what we're using).
  • My second thought is to have a dedicated resource type that simply has publish date and a reference to the applicable custom type (eg. ebook, podcase). This has the somewhat horrible experience of the author then having to publish two pieces of content (the resource and the blog post) to get the content live though.

Is there a way I haven't thought of here? How do I maintain the best authoring experience here?

Hello Paul, thanks for reaching out to the Prismic community

Using Slices many times is enough to make a Custom Type flexible enough to be reused in different cases. You can save them in the Slice library and reuse them in all types (eBoo, Tool, etc.) and write Fragments in your components to make the queries more readable.

You could also use Content Relationship fields to connect one Custom Type to another and access the fields through the query.

It all depends on how specific you need each type to be.

Can you give me more details about your use case?
And what do you mean about not being able to use Union types?

This thread has been closed due to inactivity. Flag to reopen.