Ghost API : Posts + Pages

  • What version of Ghost are you using? Latest

Hi,

I would like the ghost api to return posts and pages at the same time. Is it possible ?

/ghost/api/v3/content/pages
/ghost/api/v3/content/posts
/ghost/api/v3/content/posts+pages ? :slight_smile:

My theme use fuse.js and some js code for the search bar. The js code is not understandable, the variables are named a, b, c … So it would be much easier for me to modify the api address only, which is a Const variable.

Thanks !

Hi @Doubrovski. That is no possible on the API level. The best way to approach this problem imo would be to write a wrapper around Admin/Content API SDKs that combines the two for you.

1 Like

Hi @Doubrovski, were you able to come up with a solution for returning both posts and pages? My theme also uses fuse.js and it currently searches only blog posts.

@naz, do we have to put an endpoint for the api? Can we just use /ghost/api/v3/content/ to give access to all of the endpoints?

@naz What do you mean by writing a wrapper around Admin/Conten API SDKs? I followed the link to the GitHub repository and I’m not sure what the next action would be.

Hi,
No, sorry.
I reorganized my content. Articles that must be listed by the search engine are now posts…
And I use some filters in routes.yaml when I dont want one post to be in the loop.

Thank you for responding! Reorganizing content is a good workaround, but I intend to have pages with a lot of content that don’t make sense as posts. For example, one page that I will add to significantly soon is Glossary

I just hired the developer of the Newsportal theme, which I’m using, to tweak the them and add pages to the fuse search. Also, I asked him to add something linked IndexedDB that will allow me to have a lot of content on the site without running into performance issues with fuse.

Fuse’s performance issues are mentioned in a few places:

The possible optimization with IndexedDB is mentioned here: httgp://Adding search capabilities to Ghost

Using routes.yaml is facinating. I didn’t know about it.

When you remove the post from the loop, can you prevent it from appearing on the homepage?

@Doubrovski How do you use filters in routes.yaml to keep a post out of the loop? Can you please give an example? I think the ability to do this is very useful.