needletail/needletail-craft 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require needletail/needletail-craft
    
  3. 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-18