Skip to content

refactor: consolidate Algolia search into external js/algolia-search.js#801

Open
Parth-Garg2629 wants to merge 4 commits intoprecice:masterfrom
Parth-Garg2629:refactor/algolia-search-external-js
Open

refactor: consolidate Algolia search into external js/algolia-search.js#801
Parth-Garg2629 wants to merge 4 commits intoprecice:masterfrom
Parth-Garg2629:refactor/algolia-search-external-js

Conversation

@Parth-Garg2629
Copy link
Contributor

@Parth-Garg2629 Parth-Garg2629 commented Feb 24, 2026

Problem

The Algolia search logic existed in two near-identical places:

  • _includes/algolia.html — active inline implementation (~135 lines of JS in a template)
  • js/algolia-search.js — unused duplicate

Solution

  • _includes/algolia.html is now a thin config bridge only — it exposes Jekyll Liquid variables as window.ALGOLIA_CONFIG and loads the external JS file
  • js/algolia-search.js is now the single implementation file — reads config from window.ALGOLIA_CONFIG, pure vanilla JS with no Liquid tags

Benefits

  • ✅ Single source of truth for search logic
  • ✅ External JS is browser-cacheable (inline scripts are not)
  • ✅ Templates stay clean — no logic mixed into layout includes
  • ✅ No YAML front matter tricks needed — config passes cleanly via a global

No functional changes

Search behaviour, styling, and UX are identical to before.
The 167 lines removed = the duplicate. The code that was identical in both files now lives in one place (
algolia-search.js). Nothing was deleted that wasn't already covered by the external file.

Closes #796

@MakisH MakisH added technical Technical issues on the website GSoC Contributed in the context of the Google Summer of Code labels Feb 24, 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