How to create a query URL

I would like to create a link in some parts of the content of a post, like:

You can click here to search for Java projects.

Then, ‘here’ will be converted into an URL to resolve a query search on my blog site to show all related posts that contains a specific search pattern/word(s). Like:


Is that even possible?

Hey @JohnSmitha , welcome to Ghost!

I don’t think there’s a way to drop a search value into Ghost’s built-in sodo-search app. (That’d be a good feature - perhaps you want to add it in the Ideas forum.) I’ve set up searching by query string for a client with an Algolia integration, so it’s certainly possible there, but that’s a bigger project than perhaps you were looking for. It’s also worth noting that sodo-search only searches titles, tags, and authors, not post body, which might not meet your requirements.

But I guess I wonder if you need search here? For example, if your Java projects are all tagged ‘Java’, you already have a page at yoursite.tld/tags/java (assuming a default routes.yaml file and the tag slug is ‘java’).

I’d think about searching as something you’d need for the situation where you don’t know what the user is going to want to find. Tagging and retrieving by tags can make good sense if you’re just wanting to link to a grouping of posts.

1 Like

Thank you for your reply.

It was just an example, but my specific use case atm is searching for all the posts that has the same tille, but some part of it may change. Example:
Build your own calculator machine v1.0
Build your own calculator machine v1.1
Build your own calculator machine v1.2

In that case, I would convert the ‘here’ text to search for all the posts that matches the search results for ‘Build your own calculator machine’, excluding the ‘v#.#’ part from it. So, the user gets all the available versions of the posts, only for ‘Build your own calculator machine’.

About the second part, all my content is published under 5 different main tags. But, I don’t want anything related to that, by now. I have a theme where I can place all my (preferred) tags in the front page, so the user can filter the posts by tags by this way.

In your example, I’d think about adding an additional tag for all posts in that group, making it possible to retrieve them all together (and freeing you up to name. Many themes only display the first tag or two, so extra tags are basically invisible to users. And you can set which tags are ‘front page tags’ for those themes like Headline and Tripoli with that behavior. That theme behavior allows additional tags to be a powerful tool for grouping content.

Query strings into search would be nice, but tags are how I’d do your example if I needed to do it today and didn’t want to add a different search provider.

Didn’t think about using more tags to accomplish the same thing. Also, by this way, I can make sure what posts are inside them.

Well, I think you told me a perfect solution for the time being.

Anway, hope my future request (Idea) gets implemented in a future update.

Thank you for your support!

1 Like

Yay! Glad I could help. :)

1 Like