Skip to content

Conversation

lawofcycles
Copy link

@lawofcycles lawofcycles commented Jul 8, 2025

Description

This PR fixes broken links in search results when searching for blog posts and events from docs.opensearch.org.

For now, when using the search functionality on docs.opensearch.org, search results for blog
posts and events generate broken links. The search API returns relative URLs (e.g.,
/blog/..., /events/...) which are incorrectly resolved to
docs.opensearch.org/blog/... instead of the correct opensearch.org/blog/....

Changes

  • Updated search.js to prepend https://opensearch.org to blog and event URLs in
    search results
  • The fix detects blog/event content by checking:
    • result.type equals 'Blogs' or 'Events'
    • URL starts with /blog/ or /events/

Issues Resolved

opensearch-project/documentation-website#10711

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License.

@lawofcycles
Copy link
Author

For alternative approach, we could modify _plugins/search-indexer.rb to store
absolute URLs in the search index:

  • Blog/event URLs would be indexed as https://opensearch.org/blog/... instead of
    /blog/...
  • This would fix the issue at the data level rather than client-side

Happy to discuss if you'd prefer exploring the indexer approach instead.

@nateynateynate
Copy link
Member

Hi @lawofcycles !

I appreciate your eyes on this. I believe this is an evolutionary leftover from before we joined the Linux Foundation. We had several CI pipelines that were in use, and using relative links was the only way we could make sure that the website was being published correctly on a staging domain prior to moving it to the proper opensearch.org domain. So I'd call this one as designed.

The other half of the story is that now that we're part of the Linux Foundation, they provide all of our infrastructure and hosting. I've taken it as a priority to mention as much in our repo's README, as we no longer build our site using Jekyll but as a customized Wordpress instance. PR's that edit any of the old ruby code won't actually do anything.

We do still make use of this repo for the editorial process as well as for tracking issues related to requesting new content and updating old content. So, if you're actively having an issue with the search results as they exist today on opensearch.org, it would probably be more beneficial if you filed an issue describing the symptoms. I'll be happy to triage and verify and then ask that our overlords at the LF are able to spend some time fixing it.

And of course, feel free to reach out to me here on Github as @nateynateynate or on our Slack instance as nateboot.

Again, thanks for your keen eyes @lawofcycles !

@nateynateynate
Copy link
Member

#3957

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants