Hugo LoveIt with Algolia Search

I’ve made my personal blog with LoveIt theme and enabled Algolia search. Might be helpful for those who are trying to add Algolia search to their HUGO page.

4 Likes

Hello,

I just followed your article about adding Algolia to a Hugo site.

You mentioned that it was only a memo, but I would need more precision.

To start with, I did create my account on Algolia.
Then launched the npm command to install hugo-algolia and I see the dependencies added.

Now I added the code mentioned in the package.json but I have a doubt about the syntax.

{
  "dependencies": {
    "@fullhuman/postcss-purgecss": "github:fullhuman/postcss-purgecss",
    "autoprefixer": "^10.4.14",
    "bootstrap": "^5.3.0-alpha3",
    "hugo-algolia": "^1.2.14",
    "postcss-cli": "^10.1.0"
  },
  "scripts": {     
    "index": "hugo-algolia",     
    "index-and-send": "hugo-algolia -s" 
  } 
}

I normally use the clipped config files to make it clearer, but I had to merge everything because hugo-algolia only searches in a default config and even trying to add the -c option to the command, I can’t get it, but that’s not really the problem.

The problem is that when I run the npm run index command it starts an action, but never finishes.

Did I forget something?

In several older articles it has other files to configure like in the config.yaml.

[outputFormats.Algolia]
baseName = "algolia"
isPlainText = true
mediaType = "application/json"
notAlternative = true

[params.algolia]
vars = ["title", "summary", "date", "publishdate", "permalink"]
params = ["tags"]

[outputs]
home = ["HTML", "Algolia"]

but this is my config.yaml

algolia:
  index: hugo
  key: "my_key"
  appID: "my_appid"

Is it possible to confirm the syntax of my package.json fix?
To give me the main lines to manage to implement Algolia to my website?

Thanks in advance.

@anon86521655 sorry for responding after a long time. I no longer use Algolia on my website. If you still need help with this, I can take a look for you.
However, i have found a way simple solution than Algolia to enable search on hugo, take a look here

.