
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
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. |
This creates a new relatedFileAbsolutePaths
field on each MarkdownRemark
node, like this:
// query
query {
allMarkdownRemark {
nodes {
fileAbsolutePath
fields {
relatedFileAbsolutePaths
}
}
}
}
// result
{
"data": {
"allMarkdownRemark": {
"nodes": [
{
"fileAbsolutePath": "/home/user/blog/posts/markdown1.md",
"fields": {
"relatedFileAbsolutePaths": [
"/home/user/blog/posts/markdown4.md",
"/home/user/blog/posts/markdown2.md",
"/home/user/blog/posts/markdown3.md"
]
}
},
...
]
}
}
}
These paths are sorting by similarity. In this example, first "/home/user/blog/posts/markdown4.md" is the most related to "/home/user/blog/posts/markdown1.md".
In addition, to see all the sample code for displaying related posts, please also refer to gatsby-remark-related-posts-example.
See also this blog post(Japanese) for the motivation that created this plugin and internal algorithms.
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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.