定制 niktwenty3/related-by-taxonomy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

niktwenty3/related-by-taxonomy

Composer 安装命令:

composer require niktwenty3/related-by-taxonomy

包简介

A Statamic addon that returns related entries using common taxonomy terms (tags).

README 文档

README

A Statamic addon that returns related entries using common taxonomy terms (tags).

Features

Very basic for now.

How to Install

Will have to look into that. Never done a composer package... yet.

But, most likely it will look like this:

composer require niktwenty3/related-by-taxonomy

How to Use

For now its very limited but the basic usage is:

{{ relbytaxonomy taxonomies="tags|categories|products|authors|features" modifiers="1.2|1.5|.5|.5|1" }}
    {{ related_entries }}
        <h2>
            <a class=" " href="{{ url }}">{{ title }}</a>
        </h2>
    {{ /related_entries }}
{{ /relbytaxonomy }}

The taxonomies parameters accepts the taxonomies that will be searched for common terms with the current entry.

The modifiers parameter accepts the modifier that will be multiplied to produce the relationship score.

How it works

  1. The tag will search all posts in the current collection for common tags and will add a score on each entry depending on how many it found.
  2. The score is calculated by multiplying the modifier for the taxonomy by 1.
  3. The list created is sorted descinding by higher score and then sliced to keep only the top 4 results which are then sorted by most recent.
  4. The tag returns the results in the {{ related_entries }} variable as an object array in wich each item is a Statamic entry.

统计信息

  • 总下载量: 384
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-06-11