
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
middleman-blog-similar
Advanced tools
middleman-blog-similar
is an extension for middleman-blog that adds method to lookup similar article.
Middleman::Blog::BlogArticle#similar_articles
returns an array of Middleman::Blog::BlogArticle
instances.
h2 Similar Entries
ul
- current_article.similar_articles.first(5).each do|article|
li= link_to article.title, article.url
similar_articles
helper is also available in article pages.
h2 Similar Entries
ul
- similar_articles.first(5).each do|article|
li= link_to article.title, article.url
Gemfile
gem 'middleman-blog-similar'
config.rb
activate :similar
This extension finds similar articles using those are using tags by default.
You can set taggers using tagger:
option. MeCab and EngTagger adopters are built in this extension.
# Find by tags (default)
activate :similar, tagger: :tags
# Using MeCab / Need to add `gem 'natto'` in Gemfile
activate :similar, tagger: :mecab
# Using EngTagger / Need to add `gem 'entagger'` in Gemfile
activate :similar, tagger: :entagger
You can use lambda as tagger
# Resource is a Middleman::Blog::BlogArticle
activate :similar, tagger: ->(resource) { [resource.data.category] }
You can configure multiple taggers both built-in and lambda taggers.
activate :similar, tagger: {
# key = tagger, value = weight
mecab: 1,
entagger: 1,
tags: 3,
# key = (ignored), value[0] = weight, value[1] = lambda
custom: [5, ->(resource) { resource.data.category ? [resource.data.category] : [] }]
}
This extension uses SQLite3 to calculate similarity between articles.
Database location is ${PROJECT_ROOT}/.similar.db
by default.
You can specify database location using db:
option.
# Expands to ${HOME}/similar.db
activate :similar, db: '~/similar.db'
# Expands to ${PROJECT_ROOT}/tmp/middleman-blog-similar.db
activate :similar, db: 'tmp/middleman-blog-similar.db'
# Stores in memory database
activate :similar, db: ':memory:'
Copyright (c) 2014-2017 Atsushi Nagase. MIT Licensed, see LICENSE for details.
FAQs
Unknown package
We found that middleman-blog-similar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.