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?
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.
To configure Algolia to index content from the blog subdirectory in Netlify, Log in to your Netlify account and navigate to your site dashboard. Find the Algolia plugin in the list of installed plugins and access its settings or configuration option. Within the plugin settings, look for a field where you can specify the content path or directory to be indexed. In this case, you would set it to blog to indicate that you want Algolia to index content specifically from that subdirectory. Save the configuration changes, and Algolia should now index and search your blog content accordingly, taking into account the blog subdirectory as the source for indexing.