Skip to content

fix: moment.js loaded globally but only used in search#786

Closed
Parth-Garg2629 wants to merge 3 commits intoprecice:masterfrom
Parth-Garg2629:fix/moment-js-scope-to-search
Closed

fix: moment.js loaded globally but only used in search#786
Parth-Garg2629 wants to merge 3 commits intoprecice:masterfrom
Parth-Garg2629:fix/moment-js-scope-to-search

Conversation

@Parth-Garg2629
Copy link
Contributor

Summary

moment.js (~17KB) was loaded unconditionally on every page via _includes/head.html, but it is only used in _includes/algolia.html (line 20) to format dates in search results.

Changes

  • Removed <script src="...moment.min.js"> from _includes/head.html
  • Added it at the top of _includes/algolia.html, directly before the inline script that calls moment.unix(...).format(...)

Why

This removes a hidden global dependency and co-locates the library with its only consumer. It also prepares the codebase for conditionally loading the search widget (and its deps) in the future.

Testing

  • Verified search results still display correctly with formatted dates
  • moment.js is still loaded as part of the search widget include

Closes #785

@MakisH MakisH added the GSoC Contributed in the context of the Google Summer of Code label Feb 23, 2026
@Parth-Garg2629 Parth-Garg2629 force-pushed the fix/moment-js-scope-to-search branch from b232a77 to 187ccad Compare February 23, 2026 20:02
@MakisH MakisH added the technical Technical issues on the website label Feb 23, 2026
@fsimonis
Copy link
Member

See issue

@fsimonis fsimonis closed this Feb 26, 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.

moment.js loaded globally but only used in search

3 participants