Netlify data is located in a subdirectory. Can I set this up in Algolia?

Our blog data on Netlify is located in a subdirectory /blog/. This is configured in Netlify and so we can use a reverse proxy setup.

When I installed the Algolia plugin for Netlify, it selected my site properly, but I can’t seem to tell Algolia that is should be indexing off of the /blog/ subdirectory. Is this possible?

I managed to find the option for setting the config in the netlify.toml file, but that hasn’t seemed to get my site to index.

The pathPrefix option indeed works the other way around: when we find URLs with a path starting with /blog, we redirect to /

So the pathPrefix option is meant to crawl Netlify site that will later be deployed to a subpath of the production website, e.g.:
You deploy your site on my-netlify-preview.netlify.app/ but all the links point to /blog/mypage.html, because the site will later be deployed to https://my-prod-website.com/blog

Can’t you configure your site to be deployed on the root?
Otherwise you’ll need to configure your site so the DEPLOY_PRIME_URL points to the /blog path.
Or put a redirection to /blog

Hey Sylvain, thanks for the follow up. We can’t deploy at the root, because the site is behind Cloudfront and we use a reverse proxy to take everything from */blog on Netlify and deploy it as a subdir on our main domain. We use two different platforms for our marketing site and blog. Not ideal, but it’s the way it has to be.

So regarding your solution, I’m not really sure I follow with the DEPLOY_PRIME_URL and how that would work. In the end, I’m looking for a solution that could create the index off of my-site.netlify.app/blog/.

If this is not possible with the Aloglia/Netlify app, I’m sure I can still build this out myself with the JS API, correct?

The DEPLOY_PRIME_URL is the URL that the Crawler uses to start its crawl. If it was pointing to /blog, it would work as the crawler would start to discover other URLs.

Can’t you put a redirection from / to /blog? This will work too.

Yes you can always build an index manually with our API clients.

I’m experiencing an issue with Algolia indexing that I’m seeking assistance with. My Discourse forum is set up to have a subdirectory for specific content, and I’ve configured Algolia accordingly. It seems that Algolia is not correctly indexing content from the designated subdirectory.
visit us