Generating Landing Pages for SEO without Magento 2

Hi there,
is there a way to generate Landing Pages - ideally dynamically - in Algolia without Magento 2?
E.g. lets suppose I am selling Laptops and I have a list of all my laptops and a single menuselect by brand. If someone googles “laptop apple” I would like to have a dedicated landing page for that having the menuselect pre-filter “Apple” when someone clicks on the google landing page.
I dont really see a convenient way of doing this with Algolia other than Magento 2 which is not an option or quite hacky frontend site generation.
We are using NextJS and React in case that makes a difference.

Any help would be highly appreciated. Thanks to this awesome community.

Best

Hi @bew.fra, I did something like this with my website few years ago. The idea is to create a deterministic pattern. Something like this in nextjs

pages → [category].js → [brand].js (https://example.com/laptops/apple)

Then you need to parse the category and the brand from query params and apply these as default refinement in react-instantsearch.

You can be creative here and come up with your own version, but the principle will remain the same.
Let me know how it goes.

Thanks @harshmaur. We were already looking into this but it seems to mess with Algolias HOC “withInstantSearch”. I can see it work somehow, but its not really scalable imo. Do you have a working example of this at hand by any chance?

@bew.fra I am pasting the code that was written 3 years ago so you have to figure it out yourself since next js, react and react-instantsearch has changed a lot. :sweat_smile:

Click the link to see the whole gist

Hey Franz,

I don’t know anything about Magento or React…

In a naive JavaScript app, you could start with something like:

search.addWidget({
  init: function(opts) {
    const helper = opts.helper;
    ...
    if (window.location.href.indexOf("apple") > -1) {
      helper.setState(helper.state.setDisjunctiveFacets(['brands']));
      helper.addDisjunctiveFacetRefinement('brands', 'apple');
    }
  }
});

Then, when the user gives focus to the search box, you may - or may not - want to call

helper.clearRefinements();

Hope that helps.

Ken