Add Hugo Algolia indexing - #968
Open
MuhammadAashirAslam wants to merge 1 commit into
Open
Conversation
MuhammadAashirAslam
force-pushed
the
hugo-algolia
branch
from
August 10, 2026 04:49
424db81 to
c0a0f9e
Compare
MakisH
reviewed
Aug 10, 2026
| HUGO_VERSION: "0.163.3" | ||
| NODE_VERSION: "24.18.0" | ||
| ALGOLIA_APP_ID: "LIT6P0EW26" | ||
| ALGOLIA_INDEX_NAME: "jekyll" |
Member
There was a problem hiding this comment.
Check: Provide a different index name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the previous Jekyll Algolia plugin with a Hugo JSON export and a standalone Node.js
indexing tool.
layouts/index.algolia.json
This is a Hugo output template, not the Algolia index itself. During the Hugo build, it collects searchable
pages and writes them to public/algolia.json.
For each page, it stores:
Pages marked with search: exclude are skipped. The template also uses the existing content compatibility
layer so imported documentation is indexed after its legacy markup has been converted to Hugo-compatible
output.
tools/algolia-index.mjs
This is the standalone command-line indexer. It reads the JSON generated by Hugo and converts it into
records that Algolia can search.
The script:
The command supports a dry-run mode:
npm run algolia:index -- --dry-run
A dry run performs all parsing and validation locally without contacting Algolia.
For an actual upload, the script reads the write credential from the environment. The application ID and
index name are supplied by the workflow, while the write key remains a repository secret.
test/algolia-index.test.mjs
These tests use Node.js’s built-in test runner, so no additional test framework is required.
The tests cover the important indexing behavior:
They run with:
npm run test:algolia
package.json
This file defines the Node.js tooling used by the Algolia implementation.
It provides:
The workflow installs these dependencies with npm ci, which uses the lockfile rather than resolving
versions again.
package-lock.json
package-lock.json is generated automatically by npm from package.json. It records the exact versions,
download locations, and integrity checksums of the direct and transitive Node.js dependencies.
It is committed so that local development and GitHub Actions install the same dependency tree every time.
It should not be edited manually; it should be regenerated with npm when package.json changes.
Workflow
The workflow performs the indexing in several controlled stages:
The application ID and index name are configured to match the Hugo configuration. The workflow reads only
ALGOLIA_API_KEY from GitHub repository secrets for the write credential.