
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gatsby-remark-related-posts
Advanced tools
Calculate the similarity between posts and make it avairable from graphql.
Calculate the similarity between posts and make it available from graphql.
To calculate the similarity, this plugin using tf-idf and Cosine similarity.
npm i --save gatsby-remark-related-posts
In your gatsby-config.js
:
{
resolve: "gatsby-remark-related-posts",
options: {
posts_dir: `${__dirname}/posts`,
doc_lang: "ja",
},
},
option | description |
---|---|
posts_dir | directory that includes your markdown files. |
doc_lang | ISO 639-1 language code of your post. This supports en and ja currently. |
The plugin creates a new relatedMarkdownRemarkNodes
field on each MarkdownRemark
node, like this:
// query
{
allMarkdownRemark {
nodes {
frontmatter {
title
}
fields {
relatedMarkdownRemarks {
frontmatter {
title
}
}
}
}
}
}
// result
{
"data": {
"allMarkdownRemark": {
"nodes": [
{
"frontmatter": {
"title": "New Beginnings"
},
"fields": {
"relatedMarkdownRemarks": [
{
"frontmatter": {
"title": "Hello World"
}
},
{
"frontmatter": {
"title": "My Second Post!"
}
}
]
}
},
...
These MarkdownRemark nodes are sorting by similarity. In this example, first "Hello World" post is the most related to "New Beginnings" post.
see also: sample repo
MIT
FAQs
Calculate the similarity between posts by tf-idf and Cosine similarity.
The npm package gatsby-remark-related-posts receives a total of 306 weekly downloads. As such, gatsby-remark-related-posts popularity was classified as not popular.
We found that gatsby-remark-related-posts 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.