{"id":16294275,"url":"https://github.com/thom4parisot/hexo-algolia","last_synced_at":"2025-03-16T13:31:38.007Z","repository":{"id":33091556,"uuid":"36729024","full_name":"thom4parisot/hexo-algolia","owner":"thom4parisot","description":"Index your hexo website content to Algolia Search.","archived":false,"fork":false,"pushed_at":"2021-05-06T20:28:59.000Z","size":179,"stargazers_count":88,"open_issues_count":8,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-24T18:42:47.498Z","etag":null,"topics":["algolia","hexo-plugin","search-in-text","static-site-generation"],"latest_commit_sha":null,"homepage":"https://npmjs.com/hexo-algolia","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thom4parisot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-02T11:38:51.000Z","updated_at":"2024-11-20T00:21:06.000Z","dependencies_parsed_at":"2022-07-24T17:47:13.147Z","dependency_job_id":null,"html_url":"https://github.com/thom4parisot/hexo-algolia","commit_stats":null,"previous_names":["oncletom/hexo-algolia"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fhexo-algolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fhexo-algolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fhexo-algolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fhexo-algolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thom4parisot","download_url":"https://codeload.github.com/thom4parisot/hexo-algolia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817206,"owners_count":20352518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algolia","hexo-plugin","search-in-text","static-site-generation"],"created_at":"2024-10-10T20:14:45.426Z","updated_at":"2025-03-16T13:31:37.646Z","avatar_url":"https://github.com/thom4parisot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-algolia [![Build Status][]][pkg-build] ![][pkg-downloads] ![][pkg-version]\n\n\u003e Index content of your [hexo][] website in [Algolia][] and add search within minutes.\n\n`hexo-algolia` is an [hexo][] plugin provided by the community.\nThis is what you get when you install it:\n\n1. a **new command**, `hexo algolia`, to index the content of your website\n2. a **theme helper** to include Algolia search client\n3. another **theme helper** to configure the Algolia search client\n\n👌 The `hexo algolia` command can be run manually on your computer\nand on a continuous integration system like [Travis CI][-ci-node].\n\n📜 Browse the [CHANGELOG][] to learn what has changed between versions.\n⬢ Compatible with `node\u003e=4.0.0`.\n\n[hexo theme][]\n\n## Install\n\n```bash\n$ npm install --save hexo-algolia\n```\n\n## Public Facing Search Options\n\nYou can configure Algolia integration to your hexo website with the `_config.yml` file:\n\n``` yaml\nalgolia:\n  applicationID: 'applicationID'\n  apiKey: 'apiKey'\n  indexName: '...'\n```\n\n| Config Key | |\n| --- | --- |\n| `applicationID` | Your Algolia Application ID |\n| `apiKey` | A **Search-Only** API key |\n| `indexName` | The name of the Algolia index to use |\n\nThese configuration values are **accessible from your hexo theme**, to be used with [Algolia JavaScript client](https://www.algolia.com/doc/guides/search/auto-complete/#user-interface).\n\n## Hexo Theme Setup\n\nHelpers are provided to make your life easier.\n\n### Include Algolia JavaScript Client\n\nThe `algolia_search` theme helper adds the\n[Algolia search client][js-client] to your pages.\n\n```html\n\u003c%- algolia_search() %\u003e\n```\n\nRenders as:\n\n```html\n\u003cscript src=\"/assets/algolia/algoliasearchLite.min.js\" async\u003e\u003c/script\u003e\n```\n\n\n### Configure Algolia JavaScript Client\n\nYou can make your index configuration available to your page and client-side scripts by adding the `algolia_config()` hexo helper in the `\u003chead\u003e` of your document.\n\n```html\n\u003c%- algolia_search_config() %\u003e\n```\n\nOnce done, you can retrieve Algolia configuration by querying the\n[`data attribute`](dataset) of the `algolia:search` meta tag.\n\n```js\nconst algoliaConfig = document.querySelector('meta[property=\"algolia:search\"]').dataset;\n\nconst client = algoliasearch(algoliaConfig.applicationId, algoliaConfig.apiKey);\nconst index = client.initIndex(algoliaConfig.indexName);\n```\n\n### Display Search Results\n\nIt is now up to you to use the aforementioned example to trigger a search\nand display the results in your page.\n\nIf you need some help, have a look at the [search client doc][js-client]\nand [the tutorials][Algolia tutorials].\n\n## Indexing Content\n\nContent is indexed with the help of the `hexo algolia` command.\n\n```bash\n$ ./node_modules/.bin/hexo algolia\n```\n\n### API Key\n\nA separate _API Key_ must be provided as an **environment variable** named `HEXO_ALGOLIA_INDEXING_KEY`. Create it with **these limited write access** permissions: `Add records`, `Delete records`, `List indices`, `Delete index`.\n\n```bash\n$ export HEXO_ALGOLIA_INDEXING_KEY=…\n$ ./node_modules/.bin/hexo algolia\n```\n![](algolia-write-key.png)\n\n### Usage\n\n```\n$ ./node_modules/.bin/hexo help algolia\nUsage: ./node_modules/.bin/hexo algolia\n\nDescription:\nIndex your content in Algolia Search API\n\nOptions:\n  --dry-run       Does not push content to Algolia (default: false).\n  --flush         Resets the Algolia index before starting the indexation (default: false).\n  --indexing-key  An algolia API key with add/delete records permissions.\n\t\t  It should be different than the search-only API key configured in _config.yml.\n  --layouts       A comma-separated list of page layouts to index (default: \"page\").\n```\n\n### Security Concerns\n\n**Never store your _Admin API Key_** as `apiKey` in the `_config.yml` file: **it would give full control of your Algolia index to others** and [you don't want to face the consequences][daily-mirror-bonanza].\n\n[Please read Algolia Security guide thoroughly][security] if you need some more informations about this.\n\n# License\n\n[MIT](LICENSE)\n\n[Build Status]: https://travis-ci.org/oncletom/hexo-algolia.svg?branch=master\n[pkg-build]: https://travis-ci.org/oncletom/hexo-algolia\n[pkg-downloads]: https://img.shields.io/npm/dm/hexo-algolia.svg\n[pkg-version]: https://img.shields.io/npm/v/hexo-algolia.svg\n\n[hexo]: https://hexo.io/\n[Algolia]: https://www.algolia.com/\n[hexo theme]: https://hexo.io/docs/themes.html\n[travis-ci-node]: https://docs.travis-ci.com/user/languages/javascript-with-nodejs/\n[Algolia Tutorials]: https://www.algolia.com/doc/tutorials/\n\n[CHANGELOG]: https://github.com/oncletom/hexo-algolia/blob/master/CHANGELOG.md\n\n[js-client]: https://www.algolia.com/doc/api-client/javascript/\n[batching]: https://www.algolia.com/doc/guides/indexing/import-synchronize-data/#batching\n[security]: https://www.algolia.com/doc/guides/security/api-keys/\n[dataset]: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes\n[daily-mirror-bonanza]: http://www.mirror.co.uk/all-about/cybersecurity\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthom4parisot%2Fhexo-algolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthom4parisot%2Fhexo-algolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthom4parisot%2Fhexo-algolia/lists"}