1.0.6 • Published 1 year ago

eleventy-plugin-related v1.0.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

eleventy-plugin-related

npm Build Release Docs

Description

Filter and/or short code to rank text documents by similarity.

Install

Install using NPM or similar.

npm i eleventy-plugin-related

Usage

eleventyConfig.addFilter(
  "related",
  require("eleventy-plugin-related").related({
    serializer: (doc) => [doc.title, doc.link ?? "", doc.text ?? ""],
    weights: [10, 1, 3],
  })
);

Usage in a NunJucks template would look similar to the following.

<h3>Related</h3>
<ul>
  {% for result in story | related(stories) %}
  <li>{{ result.relative }} - {{ result.document.title }}</li>
  {% endfor %}
</ul>

For more complex options, check out the package related-documents, on which this package is based.

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago