Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have to run npm run algolia at every new post or edit? #163

Open
giuliomagnifico opened this issue Jul 19, 2024 · 2 comments
Open

I have to run npm run algolia at every new post or edit? #163

giuliomagnifico opened this issue Jul 19, 2024 · 2 comments

Comments

@giuliomagnifico
Copy link

Hello and thanks for this great theme, I'm setting up it.

But I have one question about the algolia searche, like the tile says: I have to re-run the npm run algolia when I update the website?

If yes, there's a way to keep it always running, and is it correct? I mean like create a .service file like this (sorry I'm not familiar with npm):

[Unit]
Description=Run algolia
After=network.target

[Service]
WorkingDirectory=/my-site/
ExecStart=/usr/bin/npm run algolia
Restart=always
User=root
Environment=ALGOLIA_INDEX_NAME=my-index

[Install]
WantedBy=multi-user.target

thanks!

@sshaaf
Copy link

sshaaf commented Jul 21, 2024

if you are using source control like e.g. git, then you can listen to commits via a CI server and trigger npm behaviour as one of the step in the workflow. A good example is github actions. here is an example file if it helps.
It doesnt matter if the site is then running locally, as the index is updated by the CI.

@giuliomagnifico
Copy link
Author

Thank you, unfortunately it’s not on a CI server but I found a quick and easy solution: use cron to launch the npm run algolia once per day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants