Skip to content

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

@tanishqio

Description

@tanishqio

Problem

The Algolia search logic currently exists in two places:

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

This results in duplicate code and creates confusion about which version is canonical.

Why this matters

  • Violates single source of truth (logic exists in two files)
  • Makes future changes error-prone
  • Inline JS cannot be browser-cached
  • Increases complexity inside layout templates
  • The external JS file currently appears unused

Proposed solution

  • Keep _includes/algolia.html only for passing Liquid configuration variables
  • Load js/algolia-search.js as the single implementation file
  • Remove the duplicate inline logic

This would:

  • Consolidate the implementation
  • Enable browser caching
  • Simplify templates
  • Reduce maintenance risk

No visual or functional changes are intended.


Since _includes/algolia.html was recently modified (Escape-key improvement), I wanted to open this issue first before proceeding with any structural refactor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GSoCContributed in the context of the Google Summer of CodetechnicalTechnical issues on the website

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions