如何使用 Nuxt.js 和 Nuxt Content headless CMS 向静态站点添加搜索功能

How to add a search feature to a static site using Nuxt.js and Nuxt Content headless CMS

我使用 Nuxt.js 静态站点生成和 Nuxt Content headless CMS 模块构建了一个博客网站。我现在正在尝试构建一个搜索页面,用户可以在其中输入各种查询以过滤文章,例如标题、全文、作者、发表日期等

在静态网站上可以吗?还是我必须单独托管 CMS 并发出动态请求才能使其正常工作?

静态站点之所以是“静态”的,是因为您最后拥有的文件。它不是静态的,意思是你不能使用 JS。

你完全可以使用 .filter method if you have your data locally somewhere in your data or alike, otherwise you could probably reach out for the .search method of the module