diff options
author | Igor Baiborodine <igor@kiroule.com> | 2021-11-13 00:57:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-13 00:57:05 +0300 |
commit | ee275bb511a0f809ca9891a52073a09e9e950f32 (patch) | |
tree | 0cda169da801bfcb2d23a2ccb98a85fe5d0242f2 | |
parent | aae4856c77583b46f37eefc71abf1cf5690f84ea (diff) |
Feature/migrate algolia index upload to js npm (#274)
Migrate Algolia index upload to JavaScript/npm
-rw-r--r-- | README.md | 32 | ||||
-rwxr-xr-x | exampleSite/algolia-index-upload.py | 18 | ||||
-rw-r--r-- | exampleSite/algolia/data-upload.js | 39 | ||||
-rw-r--r-- | exampleSite/algolia/package-lock.json | 608 | ||||
-rw-r--r-- | exampleSite/algolia/package.json | 15 | ||||
-rw-r--r-- | exampleSite/config.toml | 4 |
6 files changed, 681 insertions, 35 deletions
@@ -22,8 +22,8 @@ If you like this theme and/or use it for commercial purposes, please support me! - [Configuration](#Configuration) - [Features](#Features) - [Algolia Search](#Algolia-Search) - - [Setup](#Setup) - - [Update the Search Index](#Update-the-search-index) + - [Initial Setup](#Initial-setup) + - [Update Algolia Index](#Update-algolia-index) - [Keyboard Shortcuts](#Keyboard-Shortcuts) - [Post Types](#Post-Types) - [Pages and External Links](#Pages-and-External-Links) @@ -111,7 +111,7 @@ You can test it on the demo site. Just click on the navigation bar at the top right of the header. -#### Setup +#### Initial Setup If you do not want to use the search functionality set `algolia_search = false` in your `config.toml` file. If you want to include the algolia search for your site, you have to follow these steps: @@ -121,15 +121,14 @@ If you want to include the algolia search for your site, you have to follow thes 3. Switch over to `Indices` and create a new one. 4. Switch over to `API Keys` and copy your `Application ID`, `Search-Only API Key` and chosen `Index name` to your `config.toml` file. 5. Ensure that `algolia_search = true` is set. -6. Check the next section [Update the search index](#update-the-search-index), follow the steps and come back again -7. Go to the tab `Configuration` of your newly created indices, select the `Facets` in the section `FILTERING AND FACETING` and add the `language` attribute with the `filter only` modifier in the `Attributes for faceting` option. If, after adding the `language` attribute, the `Unknown attribute` error is shown, ignore it. -8. Done. +6. Follow instructions in the section [Update Algolia Index](#update-algolia-index) and proceed to the next step. +7. To complete the initial setup, go to the tab `Configuration` of your newly created indices, select the `Facets` in the section `FILTERING AND FACETING` and add the `language` attribute with the `filter only` modifier in the `Attributes for faceting` option. If, after adding the `language` attribute, the `Unknown attribute` error is shown, ignore it. -#### Update the Search Index +#### Update Algolia Index You have to repeat this step every time you change a post or publish a new one to update the search index. -Execute the 'hugo' command in the site's root directory to publish your changes. +Execute the `hugo` command in the site's root directory to publish your changes. * Manual Upload * Head over to the `public/index.json` file and copy everything in there. @@ -139,20 +138,23 @@ Execute the 'hugo' command in the site's root directory to publish your changes. * If case you have a multi-language setup, make sure that you repeat the steps above for all `public/{LANG}/index.json` files * Automated Upload - * Prerequisites: installed Python 3 and Algolia API's [Python client](https://github.com/algolia/algoliasearch-client-python). The API Python client can be installed with the following command: + + * Switch to the `algolia` directory and install required dependencies by executing the following command: ```shell script - pip install --upgrade 'algoliasearch>=2.0,<3.0' + cd algolia + npm install ``` - * Execute the `algolia-index-upload.py` from the site's root directory as follows: + * Run the `data-upload.js` from from the `algolia` directory as follows: ```shell script - python3 algolia-index-upload.py -f public/index.json -a <algolia-app-id> -k <algolia-admin-api-key> -n <algolia-index-name> + npm run data-upload -- -f ../public/index.json -a <algolia-app-id> -k <algolia-admin-api-key> -n <algolia-index-name> ``` * The `algolia-admin-api-key` argument, namely your Algolia account's `Admin API Key`, is used to create, update, and delete indices, and it should be kept secret. + * Add the `-c` or `--clear-index` option if you want to clear the corresponding Algolia index before starting a new upload. * Login to your Algolia account and verify in the `Browse` tab of your index that the index records were uploaded correctly. - * If case you have a multi-language setup, make sure that you repeat the steps above for all `public/{LANG}/index.json` files + * In case you have a multi-language setup, make sure that you repeat the steps above for all `public/{LANG}/index.json` files. -Also, you can read this [write-up](https://www.kiroule.com/article/automate-index-upload-to-algolia-search/) on how to automate -index upload to Algolia Search if you host your Bilberry theme-based website on Netlify. +Also, you can read this [write-up](https://www.kiroule.com/article/automate-data-upload-to-algolia-index-revisited/) on how to automate +data upload to Algolia Index if you host your Bilberry theme-based website on Netlify. ### Keyboard Shortcuts If you want to start a search on your blog simply type `s` and the search menu will open. diff --git a/exampleSite/algolia-index-upload.py b/exampleSite/algolia-index-upload.py deleted file mode 100755 index 0c3fe2b..0000000 --- a/exampleSite/algolia-index-upload.py +++ /dev/null @@ -1,18 +0,0 @@ -import argparse -import json -from algoliasearch.search_client import SearchClient - -parser = argparse.ArgumentParser() -parser.add_argument('-f', '--index-file', help="Index file to upload to Algolia") -parser.add_argument('-a', '--app-id', help="Algolia application ID") -parser.add_argument('-k', '--admin-api-key', help="Algolia admin API key") -parser.add_argument('-n', '--index-name', help="Algolia index name") -args = parser.parse_args() - -with open(args.index_file, 'r') as file: - indices_json = file.read().replace('\n', '') - -indices = json.loads(indices_json) -client = SearchClient.create(args.app_id, args.admin_api_key) -index = client.init_index(args.index_name) -index.save_objects(indices) diff --git a/exampleSite/algolia/data-upload.js b/exampleSite/algolia/data-upload.js new file mode 100644 index 0000000..1f70e7e --- /dev/null +++ b/exampleSite/algolia/data-upload.js @@ -0,0 +1,39 @@ +const argv = require("yargs/yargs")(process.argv.slice(2)) + .boolean("c").alias("c", "clear-index").describe("c", "Clear Algolia index before upload") + .alias("f", "index-file").nargs("f", 1).describe("f", "Index file to upload to Algolia") + .alias("a", "app-id").nargs("a", 1).describe("a", "Algolia application ID") + .alias("k", "admin-api-key").nargs("k", 1).describe("k", "Algolia admin API key") + .alias("n", "index-name").nargs("n", 1).describe("n", "Algolia index name") + .demandOption(["f", "a", "k", "n"]) + .help("h") + .alias("h", "help") + .argv; + +const algoliaSearch = require("algoliasearch"); +const client = algoliaSearch(argv["app-id"], argv["admin-api-key"]); +const algoliaIndex = client.initIndex(argv["index-name"]); +const jsonfile = require("jsonfile"); + +const saveObjects = () => { + jsonfile.readFile(argv["index-file"], function (err, indices) { + if (err) { + console.error(err); + } else { + algoliaIndex.saveObjects(indices).then(() => { + console.log("Uploaded data to index %s", argv["index-name"]); + }) + .catch(err => { + console.log(err); + }); + } + }) +}; + +if (argv["clear-index"]) { + algoliaIndex.clearObjects().then(() => { + console.log("Cleared data from index %s", argv["index-name"]); + saveObjects(); + }); +} else { + saveObjects(); +} diff --git a/exampleSite/algolia/package-lock.json b/exampleSite/algolia/package-lock.json new file mode 100644 index 0000000..ffdf3a7 --- /dev/null +++ b/exampleSite/algolia/package-lock.json @@ -0,0 +1,608 @@ +{ + "name": "algolia-helper", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "algolia-helper", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "algoliasearch": "^4.8.5", + "jsonfile": "^6.1.0", + "yargs": "^16.2.0" + } + }, + "node_modules/@algolia/cache-browser-local-storage": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.6.tgz", + "integrity": "sha512-Bam7otzjIEgrRXWmk0Amm1+B3ROI5dQnUfJEBjIy0YPM0kMahEoJXCw6160tGKxJLl1g6icoC953nGshQKO7cA==", + "dependencies": { + "@algolia/cache-common": "4.8.6" + } + }, + "node_modules/@algolia/cache-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.8.6.tgz", + "integrity": "sha512-eGQlsXU5G7n4RvV/K6qe6lRAeL6EKAYPT3yZDBjCW4pAh7JWta+77a7BwUQkTqXN1MEQWZXjex3E4z/vFpzNrg==" + }, + "node_modules/@algolia/cache-in-memory": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.8.6.tgz", + "integrity": "sha512-kbJrvCFANxL/l5Pq1NFyHLRphKDwmqcD/OJga0IbNKEulRGDPkt1+pC7/q8d2ikP12adBjLLg2CVias9RJpIaw==", + "dependencies": { + "@algolia/cache-common": "4.8.6" + } + }, + "node_modules/@algolia/client-account": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.8.6.tgz", + "integrity": "sha512-FQVJE/BgCb78jtG7V0r30sMl9P5JKsrsOacGtGF2YebqI0YF25y8Z1nO39lbdjahxUS3QkDw2d0P2EVMj65g2Q==", + "dependencies": { + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/@algolia/client-analytics": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.8.6.tgz", + "integrity": "sha512-ZBYFUlzNaWDFtt0rYHI7xbfVX0lPWU9lcEEXI/BlnkRgEkm247H503tNatPQFA1YGkob52EU18sV1eJ+OFRBLA==", + "dependencies": { + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/@algolia/client-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.8.6.tgz", + "integrity": "sha512-8dI+K3Nvbes2YRZm2LY7bdCUD05e60BhacrMLxFuKxnBGuNehME1wbxq/QxcG1iNFJlxLIze5TxIcNN3+pn76g==", + "dependencies": { + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/@algolia/client-recommendation": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.8.6.tgz", + "integrity": "sha512-Kg8DpjwvaWWujNx6sAUrSL+NTHxFe/UNaliCcSKaMhd3+FiPXN+CrSkO0KWR7I+oK2qGBTG/2Y0BhFOJ5/B/RA==", + "dependencies": { + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/@algolia/client-search": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.8.6.tgz", + "integrity": "sha512-vXLS6umL/9G3bwqc6pkrS9K5/s8coq55mpfRARL+bs0NsToOf77WSTdwzlxv/KdbVF7dHjXgUpBvJ6RyR4ZdAw==", + "dependencies": { + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/@algolia/logger-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.8.6.tgz", + "integrity": "sha512-FMRxZGdDxSzd0/Mv0R1021FvUt0CcbsQLYeyckvSWX8w+Uk4o0lcV6UtZdERVR5XZsGOqoXLMIYDbR2vkbGbVw==" + }, + "node_modules/@algolia/logger-console": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.8.6.tgz", + "integrity": "sha512-TYw9lwUCjvApC6Z0zn36T6gkCl7hbfJmnU+Z/D8pFJ3Yp7lz06S3oWGjbdrULrYP1w1VOhjd0X7/yGNsMhzutQ==", + "dependencies": { + "@algolia/logger-common": "4.8.6" + } + }, + "node_modules/@algolia/requester-browser-xhr": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.6.tgz", + "integrity": "sha512-omh6uJ3CJXOmcrU9M3/KfGg8XkUuGJGIMkqEbkFvIebpBJxfs6TVs0ziNeMFAcAfhi8/CGgpLbDSgJtWdGQa6w==", + "dependencies": { + "@algolia/requester-common": "4.8.6" + } + }, + "node_modules/@algolia/requester-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.8.6.tgz", + "integrity": "sha512-r5xJqq/D9KACkI5DgRbrysVL5DUUagikpciH0k0zjBbm+cXiYfpmdflo/h6JnY6kmvWgjr/4DoeTjKYb/0deAQ==" + }, + "node_modules/@algolia/requester-node-http": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.8.6.tgz", + "integrity": "sha512-TB36OqTVOKyHCOtdxhn/IJyI/NXi/BWy8IEbsiWwwZWlL79NWHbetj49jXWFolEYEuu8PgDjjZGpRhypSuO9XQ==", + "dependencies": { + "@algolia/requester-common": "4.8.6" + } + }, + "node_modules/@algolia/transporter": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.8.6.tgz", + "integrity": "sha512-NRb31J0TP7EPoVMpXZ4yAtr61d26R8KGaf6qdULknvq5sOVHuuH4PwmF08386ERfIsgnM/OBhl+uzwACdCIjSg==", + "dependencies": { + "@algolia/cache-common": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/requester-common": "4.8.6" + } + }, + "node_modules/algoliasearch": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.8.6.tgz", + "integrity": "sha512-G8IA3lcgaQB4r9HuQ4G+uSFjjz0Wv2OgEPiQ8emA+G2UUlroOfMl064j1bq/G+QTW0LmTQp9JwrFDRWxFM9J7w==", + "dependencies": { + "@algolia/cache-browser-local-storage": "4.8.6", + "@algolia/cache-common": "4.8.6", + "@algolia/cache-in-memory": "4.8.6", + "@algolia/client-account": "4.8.6", + "@algolia/client-analytics": "4.8.6", + "@algolia/client-common": "4.8.6", + "@algolia/client-recommendation": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/logger-console": "4.8.6", + "@algolia/requester-browser-xhr": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/requester-node-http": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "optional": true + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "engines": { + "node": ">=10" + } + } + }, + "dependencies": { + "@algolia/cache-browser-local-storage": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.6.tgz", + "integrity": "sha512-Bam7otzjIEgrRXWmk0Amm1+B3ROI5dQnUfJEBjIy0YPM0kMahEoJXCw6160tGKxJLl1g6icoC953nGshQKO7cA==", + "requires": { + "@algolia/cache-common": "4.8.6" + } + }, + "@algolia/cache-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.8.6.tgz", + "integrity": "sha512-eGQlsXU5G7n4RvV/K6qe6lRAeL6EKAYPT3yZDBjCW4pAh7JWta+77a7BwUQkTqXN1MEQWZXjex3E4z/vFpzNrg==" + }, + "@algolia/cache-in-memory": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.8.6.tgz", + "integrity": "sha512-kbJrvCFANxL/l5Pq1NFyHLRphKDwmqcD/OJga0IbNKEulRGDPkt1+pC7/q8d2ikP12adBjLLg2CVias9RJpIaw==", + "requires": { + "@algolia/cache-common": "4.8.6" + } + }, + "@algolia/client-account": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.8.6.tgz", + "integrity": "sha512-FQVJE/BgCb78jtG7V0r30sMl9P5JKsrsOacGtGF2YebqI0YF25y8Z1nO39lbdjahxUS3QkDw2d0P2EVMj65g2Q==", + "requires": { + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "@algolia/client-analytics": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.8.6.tgz", + "integrity": "sha512-ZBYFUlzNaWDFtt0rYHI7xbfVX0lPWU9lcEEXI/BlnkRgEkm247H503tNatPQFA1YGkob52EU18sV1eJ+OFRBLA==", + "requires": { + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "@algolia/client-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.8.6.tgz", + "integrity": "sha512-8dI+K3Nvbes2YRZm2LY7bdCUD05e60BhacrMLxFuKxnBGuNehME1wbxq/QxcG1iNFJlxLIze5TxIcNN3+pn76g==", + "requires": { + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "@algolia/client-recommendation": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.8.6.tgz", + "integrity": "sha512-Kg8DpjwvaWWujNx6sAUrSL+NTHxFe/UNaliCcSKaMhd3+FiPXN+CrSkO0KWR7I+oK2qGBTG/2Y0BhFOJ5/B/RA==", + "requires": { + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "@algolia/client-search": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.8.6.tgz", + "integrity": "sha512-vXLS6umL/9G3bwqc6pkrS9K5/s8coq55mpfRARL+bs0NsToOf77WSTdwzlxv/KdbVF7dHjXgUpBvJ6RyR4ZdAw==", + "requires": { + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "@algolia/logger-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.8.6.tgz", + "integrity": "sha512-FMRxZGdDxSzd0/Mv0R1021FvUt0CcbsQLYeyckvSWX8w+Uk4o0lcV6UtZdERVR5XZsGOqoXLMIYDbR2vkbGbVw==" + }, + "@algolia/logger-console": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.8.6.tgz", + "integrity": "sha512-TYw9lwUCjvApC6Z0zn36T6gkCl7hbfJmnU+Z/D8pFJ3Yp7lz06S3oWGjbdrULrYP1w1VOhjd0X7/yGNsMhzutQ==", + "requires": { + "@algolia/logger-common": "4.8.6" + } + }, + "@algolia/requester-browser-xhr": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.6.tgz", + "integrity": "sha512-omh6uJ3CJXOmcrU9M3/KfGg8XkUuGJGIMkqEbkFvIebpBJxfs6TVs0ziNeMFAcAfhi8/CGgpLbDSgJtWdGQa6w==", + "requires": { + "@algolia/requester-common": "4.8.6" + } + }, + "@algolia/requester-common": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.8.6.tgz", + "integrity": "sha512-r5xJqq/D9KACkI5DgRbrysVL5DUUagikpciH0k0zjBbm+cXiYfpmdflo/h6JnY6kmvWgjr/4DoeTjKYb/0deAQ==" + }, + "@algolia/requester-node-http": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.8.6.tgz", + "integrity": "sha512-TB36OqTVOKyHCOtdxhn/IJyI/NXi/BWy8IEbsiWwwZWlL79NWHbetj49jXWFolEYEuu8PgDjjZGpRhypSuO9XQ==", + "requires": { + "@algolia/requester-common": "4.8.6" + } + }, + "@algolia/transporter": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.8.6.tgz", + "integrity": "sha512-NRb31J0TP7EPoVMpXZ4yAtr61d26R8KGaf6qdULknvq5sOVHuuH4PwmF08386ERfIsgnM/OBhl+uzwACdCIjSg==", + "requires": { + "@algolia/cache-common": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/requester-common": "4.8.6" + } + }, + "algoliasearch": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.8.6.tgz", + "integrity": "sha512-G8IA3lcgaQB4r9HuQ4G+uSFjjz0Wv2OgEPiQ8emA+G2UUlroOfMl064j1bq/G+QTW0LmTQp9JwrFDRWxFM9J7w==", + "requires": { + "@algolia/cache-browser-local-storage": "4.8.6", + "@algolia/cache-common": "4.8.6", + "@algolia/cache-in-memory": "4.8.6", + "@algolia/client-account": "4.8.6", + "@algolia/client-analytics": "4.8.6", + "@algolia/client-common": "4.8.6", + "@algolia/client-recommendation": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/logger-console": "4.8.6", + "@algolia/requester-browser-xhr": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/requester-node-http": "4.8.6", + "@algolia/transporter": "4.8.6" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "optional": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==" + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==" + } + } +} diff --git a/exampleSite/algolia/package.json b/exampleSite/algolia/package.json new file mode 100644 index 0000000..66a05c4 --- /dev/null +++ b/exampleSite/algolia/package.json @@ -0,0 +1,15 @@ +{ + "name": "algolia-helper", + "version": "1.0.0", + "description": "Algolia helper for sending and managing data", + "dependencies": { + "algoliasearch": "^4.8.5", + "jsonfile": "^6.1.0", + "yargs": "^16.2.0" + }, + "scripts": { + "data-upload": "node data-upload.js" + }, + "author": "Igor Baiborodine", + "license": "MIT" +} diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 2948011..97366df 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -42,8 +42,8 @@ disqusShortname = "" algolia_appId = "45CEN6X6AT" algolia_apiKey = "16030625f1a4d0dd3b8aefd794fd4cf1" algolia_indexName = "bilberry-hugo-theme" - # Set this option to false if you want to search within all articles in all languages at once - algolia_currentLanguageOnly = true + # Set this option to false if you want to search within all articles in all languages at once + algolia_currentLanguageOnly = true # Enable / Disable comments on the articles via commento commentoJsURL = "https://commento.lednerb.de/js/commento.js" |