needletail/needletail-craft
最新稳定版本:v5.0.6
Composer 安装命令:
composer require needletail/needletail-craft
包简介
Needletail Search and Index package for Craft CMS
README 文档
README
Needletail Search and Index package for Craft 3.x
Requirements
This plugin requires Craft CMS 3 or 4
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require needletail/needletail-craft -
In the Control Panel, go to Settings → Plugins and click the “Install” button for Needletail.
Brought to you by Needletail
Custom Twig file
You can create a custom twig file to render the results. To do this, create a new file in your templates folder called _needletail/[[BUCKET_NAME]].twig. This file will be used to render the search results. You can use the following variables in this file:
entry- The record that will be rendered
Example:
{
"title": "{{ entry.title }}",
"slug": "{{ entry.slug }}",
"url": "{{ entry.getUrl() }}",
"date": "{{ entry.postDate|date('Y-m-d') }}",
"author": "{{ entry.author }}"
}
Testing:
For easy testing you can create a new twig file in your templates folder [[BUCKET_NAME]].json.twig and add the following code:
{% set entry = craft.entries({id: [[ENTRY_ID]]}).one() %}
{% include "_needletail/[[BUCKET_NAME]].twig" %}
You can then call $PRIMARY_SITE_URL/[[BUCKET_NAME]].json in your browser to see the rendered result.
Note! Make sure to replace
[[BUCKET_NAME]]and[[ENTRY_ID]]with the correct values.
统计信息
- 总下载量: 749
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-18