I'm a software developer who writes about Laravel, JavaScript, Rails, Linux, Docker, WordPress and the tech industry. Follow me on Twitter @tylerlwsmith
I was using markdown for a few pages, so I haven't implemented this in Next.js. I'd personally lean towards option 2 and be very careful to make sure that no one can execute a directory traversal attack.
In the past on non-Next.js sites, I've actually ingested the markdown content into a SQLite DB on application bootup and used that for searching with LIKE queries. It wasn't typo tolerant, but it was good enough for my needs. I had less than 100 posts though, and if I had upwards of 1000 it would probably slow down the application bootup.
I was using markdown for a few pages, so I haven't implemented this in Next.js. I'd personally lean towards option 2 and be very careful to make sure that no one can execute a directory traversal attack.
In the past on non-Next.js sites, I've actually ingested the markdown content into a SQLite DB on application bootup and used that for searching with LIKE queries. It wasn't typo tolerant, but it was good enough for my needs. I had less than 100 posts though, and if I had upwards of 1000 it would probably slow down the application bootup.
Thanks for sharing your thoughts.