使用 Simple-Jekyll-Search 搜索你的文章
Requirements
- a Jekyll blog (of course)
Create search.json
Create a file search.json
with this content:
1 | {% raw %} |
Prepare HTML
In your template add the following markup to define a placeholder for the search widget:
1 | <input type="text" id="search-input" placeholder="search posts.."> |
Initialize search widget
Add the following script tag to your base/default _layout
:
1 | <script src="https://unpkg.com/simple-jekyll-search@1.5.0/dest/simple-jekyll-search.min.js"></script> |
And in a separate script tag:
1 | <script> |
That’s all!
参考资料
- https://github.com/christian-fei/Simple-Jekyll-Search