
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
best-blog-data
Advanced tools
A powerful and lightweight npm package for working with structured blog post data, featuring 200+ dummy posts out of the box. Includes built-in pagination, categorization, fuzzy search, and full TypeScript support. Perfect for static blogs, CMS backends,
A powerful and lightweight npm package for working with structured blog post data, featuring 200+ dummy posts out of the box. Includes built-in pagination, categorization, fuzzy search, and full TypeScript support. Perfect for static blogs, CMS backends, or frontend demos.
[!NOTE] 😍 200+ Posts and 30 Categories with SEO Meta!
npm install best-blog-data
or
pnpm add best-blog-data
import BestBlogData from 'best-blog-data'
const blogData = new BestBlogData()
const { posts, nextPageAvailable } = blogData.getPosts() // Defaults to page 1
console.log(posts.length) // Up to 10 posts
const page2 = blogData.getPosts(2)
console.log(page2.posts.length)
const post = blogData.getFullPostBySlug('my-blog-post-slug')
if (post) {
console.log(post.title)
}
const { posts, nextPageAvailable, categoryFound } =
blogData.getPostsByCategory('technology')
if (categoryFound) {
console.log(posts)
}
const reactPostsPage2 = blogData.getPostsByCategory('react', 2)
const categories = blogData.getAllCategories()
console.log(categories)
// [
// { slug: 'react', name: 'React' },
// { slug: 'ai', name: 'Artificial Intelligence' },
// ...
// ]
const searchResults = blogData.getPostsBySearch('AI content')
searchResults.forEach(({ item, score }) => {
console.log(`${item.title} (score: ${score})`)
})
blogData.getPosts(pageIndex?: number): { posts: Post[], nextPageAvailable: boolean }
Returns paginated posts (10 per page by default).
blogData.getFullPostBySlug(slug: string): Post | undefined
Fetch a single post by its unique slug.
blogData.getPostsByCategory(categorySlug: string, pageIndex?: number): { posts: Post[], nextPageAvailable: boolean, categoryFound: boolean }
Retrieve posts filtered by a category slug.
blogData.getAllCategories(): Category[]
Returns a list of all unique categories found in posts.
blogData.getPostsBySearch(query: string): FuseResult<Post>[]
Performs fuzzy search across post titles. Returns max 10 results with match scores.
Post
interface Post {
slug: string
title: string
content?: string
date: string
image: string
categorie: {
slug: string
name: string
}
meta_seo: {
title: string
description: string
image: string
url: string
}
}
Category
interface Category {
slug: string
name: string
}
0.3
['title']
10 results
fuse.js
— Fuzzy search engineThis package is fully typed with built-in definitions, ensuring IntelliSense and compile-time safety in modern editors and TypeScript projects.
Found a bug or have a feature idea? PRs and issues are welcome!
git clone https://github.com/devgauravjatt/best-blog-data
MIT © devgauravjatt
blog
, cms
, posts
, pagination
, search
, categories
, typescript
, fuse
, content
, npm-package
FAQs
A powerful and lightweight npm package for working with structured blog post data, featuring 200+ dummy posts out of the box. Includes built-in pagination, categorization, fuzzy search, and full TypeScript support. Perfect for static blogs, CMS backends,
We found that best-blog-data demonstrated a healthy version release cadence and project activity because the last version was released less than 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.