How to define career or portfolio or testimonial page in Ghost headless?

We are using Gatsby and Ghost in the combination. We are using Ghost headless. We have successfully integrated blogs and it’s working fine.

But we are not sure what is the best approach to handle the following pages.

  • Career Page (Admin should be able to create multiple career positions from Ghost)
  • Portfolio Page (Admin should be able to create multiple portfolios into Ghost)
  • Testimonial (Admin should be able to create multiple Testimonial into Ghost)

We want to fetch above things through APIs without HTML. Is it possible with Ghost? What is the best approach to handle such kind of scenario?

Hey @krunal_shah1 :wave:

The best way to handle content like this is with internal tags (they start with hash-). These tags are not meant to be public and can be used to internally categorize content. For example, you can create a page with the slug hash-career and then in Gatsby, run a query where the tag list contains hash-career

4 Likes

Yes exactly this! I’m using this right now to filter posts into blog articles and portfolio work using internal tags. I’m using Eleventy for the front-end and exposing those filtered groups as custom collections, so I can collections.posts and collections.work :zap:

1 Like

Thanks @vikaspotluri123 @DavidDarnes

I will try your suggestions and also share more details here.

1 Like

@DavidDarnes So, as per my understanding. If I want to implement custom collection I need to make change into .hbs files. Correct?

This is what I need to follow - https://ghost.org/docs/api/v3/handlebars-themes/routing/collections/ ?

Hey @krunal_shah1,

The routes file in Ghost is for use with the Handlebars theme layer and not the Content API.

The Ghost Content API exposes everything you need to create the post type yourself within GraphQL. Check out our GraphQL recipes where we have an example of filtering posts by a tag:

In the case of a internal tag the slug value will be hash-career.

Hope this helps! :blush:

To implement testimonials, we have created different pages for each testimonial with tag #-testimonial. You can look into the attached image how we have created pages.

On the gatsby side, we are fetching testimonials through API and we are filtering pages with the tags #-testimonial.

Steps

  1. Create pages on ghost with unique tag.
  2. Fetch those pages in the gatsby side.
1 Like

This is great! Thanks for sharing :raised_hands: