Skip to content

refactor: consolidate Algolia search logic into algolia-search.js#823

Closed
anuj452005 wants to merge 1 commit intoprecice:masterfrom
anuj452005:refactor/consolidate-algolia-search
Closed

refactor: consolidate Algolia search logic into algolia-search.js#823
anuj452005 wants to merge 1 commit intoprecice:masterfrom
anuj452005:refactor/consolidate-algolia-search

Conversation

@anuj452005
Copy link
Copy Markdown

Summary

Consolidates the Algolia search implementation into a single file,
eliminating duplicate logic between _includes/algolia.html and
js/algolia-search.js.

Problem

The search logic existed in two places:

  • _includes/algolia.html — active inline implementation (used in production)
  • js/algolia-search.js — unused external file with outdated logic

This violated the single source of truth principle, prevented browser
caching of the search JS, and added unnecessary complexity to the layout template.

Changes

  • _includes/algolia.html: Reduced to a single <script src> tag
  • js/algolia-search.js: Now the canonical implementation, updated with:
    • Dynamic keyboard shortcut placeholder (⌘K / Ctrl+K)
    • Escape-key handler (ported from the recent improvement in algolia.html)
    • Jekyll front matter for Liquid variable processing

No functional changes intended

Search behavior, keyboard shortcuts, and UI remain identical.
This is a structural refactor only.

Testing

  • Site runs locally with bundle exec jekyll serve -l

closes #796

@MakisH
Copy link
Copy Markdown
Member

MakisH commented Mar 14, 2026

This was solving the same problem as #801, in a similar way. A simpler way would be to just remove the duplicate file, for which not so much explanation is required. I implemented that in #851.

@MakisH MakisH closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Algolia search to use external js/algolia-search.js (remove duplicate inline implementation)

2 participants