Support Forums

Getting netify to work with comments (wordpress build)

I am planning to use netify with WordPress.
Will be using wp2static plugin on WordPress to generate static copy and then deploy on netlify.
But how can I make comments and search function work with netlfiy?
here’s an example site that’s using netlify + WordPress and has comments section enabled : The Backlinko SEO Blog by Brian Dean
I am newbie so if anyone of you could point me towards right direction, that would mean alot!

I’m also a newbie and also moving my site off of Wordpress. I didn’t know it was even possible to have a comments section until I read your post.

I’m guessing maybe through functions? Form submissions | Netlify Docs

And have it kick off a build…?

I’m going to watch this thread so I can learn too!

Hi @jacksn,

In Wordpress, comments and search are driven by PHP, in Netlify it’s either JavaScript or nothing.

There are various JS-based search libraries line FlexSearch, Lunr, etc. that could handle the client-side search functionality. They might/might not be as good as the PHP one, but can get the job done in many cases. You can also choose to use a 3-rd party tool for better indexing like Algolia search.

The comments have a similar problem. Since there’s no database to store and retrieve comments, you have to look for external sources. There are various comment solutions for static websites like Discus, Gitalk, etc. You can also write a custom logic like I had done once:

Basically, it all boils down to: You’d either have to write the functionality yourself, or rely on some third-party tool to handle it for you.

1 Like

From what I can tell, JavaScript fetches from an API connected to a (likely) headless WordPress instance using GraphQL.

The solution you choose will depend on what you can/want to give. On top of @hrishikesh suggestions, might this a good read @jacksn and @aakoch (though it doesn’t mention comments per se.)

Hi. I`m using GitHub to store copies of the site. Just give Netlify access to the repository of choice, set the publish directory in case you placed all statically generated files in a sub-folder. Since everything is already statically generated, no build steps or anything are necessary.