How can I make search pages also

Is there something I’m missing? It doesn’t work for pages.

5 Likes

Not a lot of information here to work from big dog. Since it works on pages or posts from me using the guide from this post - Native search

It doesn’t say pages anywhere. In fact, I tested it on my blog… nope, doesn’t work for pages.

1 Like

In fact I tested it on my blog and it does work on pages.

Are you certain? AFAIK Ghost Native Search returns results for tags, authors, and posts. This is my experience, too.

1 Like

Doesn’t work for me on pages, but it does on everything else.

1 Like

Just bumping this one. Searching pages would be a useful feature to have. I have the most recent Bitnami ghost install running and it only searches posts. All the docs only mention post, tag and author searches.

4 Likes

Fully agree.

I’m planning to implement Algolia but pages searching needs to be implemented to the core (I don’t know why that’s not enabled by default).

4 Likes

Bump, I agree this is important.

2 Likes

+1 - I think users will expect global search of all content on the site.

2 Likes

Since this thread got bumped, here are a couple options for anyone who needs their pages searched right now:

  1. Abandon pages. Create everything as posts. This avoids limitations to routing pages, and makes your posts searchable. Use routes.yaml to suppress these ‘page’-like posts from being shown on the blog index, perhaps by giving them a #pages tag. This is almost certainly the easiest, working right now solution, and can be done even on Ghost Pro starter. (You’ll only need to upload a new routes.yaml.

  2. Abandon the built-in sodo-search.
    2a) Switch to full text search with Algolia (which is likely to fit in the free tier for any site small enough to search with sodo-search anyway), which actually gives you better search functionality than the build in search, since you can choose to search the full post body. Using an external search provider (i.e. Algolia) will also require a service to keep that external provider’s database up to date with Ghost, but there’s a one-click Netlify install that works for getting basic synchronization working.
    2b) Switch to fuse.js or another free front-end search option with more functionality. If your site is small enough, you could even set it to full text search.
    Either 2a or 2b will require some theme editing. If you want to avoid the sodo-search script loading even though you’re not using it, self-hosters can edit config.json, and Ghost Pro hosters can see 3b below.

  3. Fork sodo-search. It’s in @tryghost/apps, and you have a working example of how to load content right there for posts and the pages API is identical, so it’d be a pretty easy adjustment if you’re comfortable with coding.
    3a) Self-hosters can specify where to load the forked sodo-search from in config.production.json.
    3b) Ghost Pro hosters are going to need to remove {{ghost_head}} from their theme’s default.hbs and manually code the header section, to avoid loading the built-in version. As best I can see, the only thing you’ll have to hard code (instead of pulling values from the @site object) is the content API key. This will require the ability to upload a modified theme (so not Ghost Pro starter.)

2 Likes

This post just showed up in my activity because someone liked it. I’ll amend option #1 very slightly to say that now that there’s the special formatting for pages where you can suppress the title and featured image for a page (but not a post), this decision might be less attractive to users who want to build landing-page like pages without theme editing.

(If you can edit your theme, you could still do something like 1, but make a copy of your post template that excludes the featured image and title.)

I agree with everyone here that search should search everything, including pages.

I’ve also just submitted an issue on GitHub to that effect:

If you would like Search to search pages (as it obviously should imho), please upvote here @boycottseattle.xyz @justind000 @matenauta @quddus @LarrySwanson @Cathy_Sarisky

and I guess here too for good measure:

Thanks! :pray: :palms_up_together: :fist:

3 Likes

+1 for site wide search!

2 Likes