@power-seo/content-analysis 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +274 -0
- package/dist/index.cjs +527 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +518 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +677 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +50 -0
- package/dist/react.d.ts +50 -0
- package/dist/react.js +673 -0
- package/dist/react.js.map +1 -0
- package/dist/types-BGadIBx8.d.cts +9 -0
- package/dist/types-BGadIBx8.d.ts +9 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# @power-seo/content-analysis — Yoast-Style SEO Content Scoring Engine for React & Node.js
|
|
2
|
+
|
|
3
|
+
Keyword-focused content analysis with real-time scoring, readability checks, and actionable feedback — like Yoast SEO, but as a standalone TypeScript library that works anywhere.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@power-seo/content-analysis)
|
|
6
|
+
[](https://www.npmjs.com/package/@power-seo/content-analysis)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://bundlephobia.com/package/@power-seo/content-analysis)
|
|
10
|
+
|
|
11
|
+
`@power-seo/content-analysis` gives you a complete Yoast-style SEO scoring pipeline for any text content. Feed it a page's title, meta description, body HTML, focus keyphrase, images, and links — get back structured `good` / `improvement` / `error` results for every SEO factor. Run it server-side in a CMS, client-side in a React editor, or inside a CI content quality gate. All checks are individually configurable and tree-shakeable.
|
|
12
|
+
|
|
13
|
+
> **Zero runtime dependencies** — only `@power-seo/core` as a peer.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Keyphrase density check** — scores optimal 0.5–3% keyword frequency in body copy
|
|
18
|
+
- **Keyphrase distribution** — verifies the focus keyword appears in the first 10% of content
|
|
19
|
+
- **Title checks** — detects missing titles and keyphrase absence in the `<title>` tag
|
|
20
|
+
- **Meta description checks** — validates presence, length (120–158 chars), and keyphrase inclusion
|
|
21
|
+
- **Heading structure** — ensures H1 exists and that the keyphrase appears in at least one heading
|
|
22
|
+
- **Word count** — flags pages under the 300-word minimum threshold
|
|
23
|
+
- **Image alt text** — scans all images for missing alt attributes
|
|
24
|
+
- **Image keyphrase** — checks whether at least one image alt contains the focus keyphrase
|
|
25
|
+
- **Internal and external link analysis** — verifies outbound and inbound link presence
|
|
26
|
+
- **Configurable check suite** — disable any individual check via `disabledChecks` config
|
|
27
|
+
- **Framework-agnostic** — works in Next.js, Remix, Gatsby, Vite, vanilla Node.js
|
|
28
|
+
- **Full TypeScript support** — complete type definitions for all inputs, outputs, and check IDs
|
|
29
|
+
- **Tree-shakeable** — import only the checks you use; zero dead code in your bundle
|
|
30
|
+
|
|
31
|
+
## Table of Contents
|
|
32
|
+
|
|
33
|
+
- [Installation](#installation)
|
|
34
|
+
- [Quick Start](#quick-start)
|
|
35
|
+
- [Usage](#usage)
|
|
36
|
+
- [Running All Checks at Once](#running-all-checks-at-once)
|
|
37
|
+
- [Running Individual Checks](#running-individual-checks)
|
|
38
|
+
- [Disabling Specific Checks](#disabling-specific-checks)
|
|
39
|
+
- [Using in a React Editor](#using-in-a-react-editor)
|
|
40
|
+
- [API Reference](#api-reference)
|
|
41
|
+
- [`analyzeContent()`](#analyzecontent)
|
|
42
|
+
- [Individual Check Functions](#individual-check-functions)
|
|
43
|
+
- [Types](#types)
|
|
44
|
+
- [The @power-seo Ecosystem](#the-power-seo-ecosystem)
|
|
45
|
+
- [About CyberCraft Bangladesh](#about-cybercraft-bangladesh)
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install @power-seo/content-analysis
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
yarn add @power-seo/content-analysis
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm add @power-seo/content-analysis
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { analyzeContent } from '@power-seo/content-analysis';
|
|
65
|
+
|
|
66
|
+
const result = await analyzeContent({
|
|
67
|
+
keyphrase: 'react seo',
|
|
68
|
+
title: 'How to Add SEO to React Apps',
|
|
69
|
+
metaDescription: 'A complete guide to adding SEO meta tags, Open Graph, and structured data in React.',
|
|
70
|
+
bodyHtml: '<h1>React SEO Guide</h1><p>Search engine optimization for React...</p>',
|
|
71
|
+
images: [{ src: '/hero.jpg', alt: 'React SEO diagram' }],
|
|
72
|
+
links: {
|
|
73
|
+
internal: ['https://example.com/blog'],
|
|
74
|
+
external: ['https://developers.google.com/search'],
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(result.score); // e.g. 82
|
|
79
|
+
console.log(result.results); // array of { id, status, message }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
|
|
84
|
+
### Running All Checks at Once
|
|
85
|
+
|
|
86
|
+
`analyzeContent()` runs all 13 built-in checks and returns an aggregated score (0–100) along with per-check results.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { analyzeContent } from '@power-seo/content-analysis';
|
|
90
|
+
|
|
91
|
+
const output = await analyzeContent({
|
|
92
|
+
keyphrase: 'next.js seo',
|
|
93
|
+
title: 'Next.js SEO Best Practices',
|
|
94
|
+
metaDescription: 'Learn how to optimize your Next.js app for search engines with meta tags and structured data.',
|
|
95
|
+
bodyHtml: htmlString,
|
|
96
|
+
wordCount: 1250,
|
|
97
|
+
images: imageList,
|
|
98
|
+
links: { internal: internalLinks, external: externalLinks },
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// output.score → number 0–100
|
|
102
|
+
// output.results → AnalysisResult[]
|
|
103
|
+
// output.status → 'good' | 'improvement' | 'error'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Running Individual Checks
|
|
107
|
+
|
|
108
|
+
Each check is exported as a standalone function — useful when you want to run only a subset of the analysis.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import {
|
|
112
|
+
checkTitle,
|
|
113
|
+
checkMetaDescription,
|
|
114
|
+
checkKeyphraseUsage,
|
|
115
|
+
checkHeadings,
|
|
116
|
+
checkWordCount,
|
|
117
|
+
checkImages,
|
|
118
|
+
checkLinks,
|
|
119
|
+
} from '@power-seo/content-analysis';
|
|
120
|
+
|
|
121
|
+
const titleResult = checkTitle({ keyphrase: 'react seo', title: 'React SEO Guide' });
|
|
122
|
+
// { id: 'title-keyphrase', status: 'good', message: 'Focus keyphrase found in title.' }
|
|
123
|
+
|
|
124
|
+
const wc = checkWordCount({ wordCount: 250 });
|
|
125
|
+
// { id: 'word-count', status: 'improvement', message: 'Word count is below 300 words.' }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Disabling Specific Checks
|
|
129
|
+
|
|
130
|
+
Pass `config.disabledChecks` to skip checks that don't apply to your content type (e.g. skip image checks on text-only pages):
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { analyzeContent } from '@power-seo/content-analysis';
|
|
134
|
+
|
|
135
|
+
const output = await analyzeContent(input, {
|
|
136
|
+
disabledChecks: ['image-alt', 'image-keyphrase', 'external-links'],
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Using in a React Editor
|
|
141
|
+
|
|
142
|
+
Integrate live scoring into a content editor — re-run analysis on every keystroke or debounced change:
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { useState, useEffect } from 'react';
|
|
146
|
+
import { analyzeContent } from '@power-seo/content-analysis';
|
|
147
|
+
import type { ContentAnalysisOutput } from '@power-seo/content-analysis';
|
|
148
|
+
|
|
149
|
+
function SeoScorePanel({ content }: { content: EditorContent }) {
|
|
150
|
+
const [analysis, setAnalysis] = useState<ContentAnalysisOutput | null>(null);
|
|
151
|
+
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
analyzeContent({
|
|
154
|
+
keyphrase: content.keyphrase,
|
|
155
|
+
title: content.title,
|
|
156
|
+
metaDescription: content.description,
|
|
157
|
+
bodyHtml: content.html,
|
|
158
|
+
}).then(setAnalysis);
|
|
159
|
+
}, [content]);
|
|
160
|
+
|
|
161
|
+
if (!analysis) return null;
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<div>
|
|
165
|
+
<p>SEO Score: {analysis.score}/100</p>
|
|
166
|
+
{analysis.results.map((r) => (
|
|
167
|
+
<div key={r.id} className={`check-${r.status}`}>
|
|
168
|
+
{r.message}
|
|
169
|
+
</div>
|
|
170
|
+
))}
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## API Reference
|
|
177
|
+
|
|
178
|
+
### `analyzeContent()`
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
function analyzeContent(
|
|
182
|
+
input: ContentAnalysisInput,
|
|
183
|
+
config?: AnalysisConfig
|
|
184
|
+
): Promise<ContentAnalysisOutput>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### `ContentAnalysisInput`
|
|
188
|
+
|
|
189
|
+
| Prop | Type | Description |
|
|
190
|
+
|------|------|-------------|
|
|
191
|
+
| `keyphrase` | `string` | Focus keyphrase to analyze against |
|
|
192
|
+
| `title` | `string` | Page `<title>` content |
|
|
193
|
+
| `metaDescription` | `string` | Meta description content |
|
|
194
|
+
| `bodyHtml` | `string` | Full body HTML string |
|
|
195
|
+
| `wordCount` | `number` | Pre-computed word count (optional; auto-detected from `bodyHtml` if omitted) |
|
|
196
|
+
| `images` | `Array<{src: string; alt?: string}>` | Images found on the page |
|
|
197
|
+
| `links` | `{internal: string[]; external: string[]}` | Internal and external link URLs |
|
|
198
|
+
|
|
199
|
+
#### `ContentAnalysisOutput`
|
|
200
|
+
|
|
201
|
+
| Field | Type | Description |
|
|
202
|
+
|-------|------|-------------|
|
|
203
|
+
| `score` | `number` | Aggregate score 0–100 |
|
|
204
|
+
| `status` | `AnalysisStatus` | `'good'` (≥70) \| `'improvement'` (≥40) \| `'error'` (<40) |
|
|
205
|
+
| `results` | `AnalysisResult[]` | Per-check results |
|
|
206
|
+
|
|
207
|
+
#### `AnalysisResult`
|
|
208
|
+
|
|
209
|
+
| Field | Type | Description |
|
|
210
|
+
|-------|------|-------------|
|
|
211
|
+
| `id` | `CheckId` | Unique check identifier |
|
|
212
|
+
| `status` | `AnalysisStatus` | `'good'` \| `'improvement'` \| `'error'` |
|
|
213
|
+
| `message` | `string` | Human-readable feedback |
|
|
214
|
+
|
|
215
|
+
### Individual Check Functions
|
|
216
|
+
|
|
217
|
+
| Function | Checks For |
|
|
218
|
+
|----------|-----------|
|
|
219
|
+
| `checkTitle(input)` | Title presence and keyphrase inclusion |
|
|
220
|
+
| `checkMetaDescription(input)` | Description presence, length, keyphrase |
|
|
221
|
+
| `checkKeyphraseUsage(input)` | Density (0.5–3%) and distribution |
|
|
222
|
+
| `checkHeadings(input)` | H1 existence and keyphrase in headings |
|
|
223
|
+
| `checkWordCount(input)` | Minimum 300-word threshold |
|
|
224
|
+
| `checkImages(input)` | Alt text presence and keyphrase in alt |
|
|
225
|
+
| `checkLinks(input)` | Internal and external link presence |
|
|
226
|
+
|
|
227
|
+
### Types
|
|
228
|
+
|
|
229
|
+
| Type | Description |
|
|
230
|
+
|------|-------------|
|
|
231
|
+
| `CheckId` | Union of all 13 built-in check IDs |
|
|
232
|
+
| `AnalysisConfig` | `{ disabledChecks?: CheckId[] }` |
|
|
233
|
+
| `AnalysisStatus` | `'good' \| 'improvement' \| 'error'` |
|
|
234
|
+
| `ContentAnalysisInput` | Input shape for `analyzeContent()` |
|
|
235
|
+
| `ContentAnalysisOutput` | Output shape from `analyzeContent()` |
|
|
236
|
+
|
|
237
|
+
## The @power-seo Ecosystem
|
|
238
|
+
|
|
239
|
+
All 17 packages are independently installable — use only what you need.
|
|
240
|
+
|
|
241
|
+
| Package | Install | Description |
|
|
242
|
+
|---------|---------|-------------|
|
|
243
|
+
| [`@power-seo/core`](https://www.npmjs.com/package/@power-seo/core) | `npm i @power-seo/core` | Framework-agnostic utilities, types, validators, and constants |
|
|
244
|
+
| [`@power-seo/react`](https://www.npmjs.com/package/@power-seo/react) | `npm i @power-seo/react` | React SEO components — meta, Open Graph, Twitter Card, breadcrumbs |
|
|
245
|
+
| [`@power-seo/meta`](https://www.npmjs.com/package/@power-seo/meta) | `npm i @power-seo/meta` | SSR meta helpers for Next.js App Router, Remix v2, and generic SSR |
|
|
246
|
+
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 20 builders + 18 React components |
|
|
247
|
+
| [`@power-seo/content-analysis`](https://www.npmjs.com/package/@power-seo/content-analysis) | `npm i @power-seo/content-analysis` | Yoast-style SEO content scoring engine with React components |
|
|
248
|
+
| [`@power-seo/readability`](https://www.npmjs.com/package/@power-seo/readability) | `npm i @power-seo/readability` | Readability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI |
|
|
249
|
+
| [`@power-seo/preview`](https://www.npmjs.com/package/@power-seo/preview) | `npm i @power-seo/preview` | SERP, Open Graph, and Twitter/X Card preview generators |
|
|
250
|
+
| [`@power-seo/sitemap`](https://www.npmjs.com/package/@power-seo/sitemap) | `npm i @power-seo/sitemap` | XML sitemap generation, streaming, index splitting, and validation |
|
|
251
|
+
| [`@power-seo/redirects`](https://www.npmjs.com/package/@power-seo/redirects) | `npm i @power-seo/redirects` | Redirect engine with Next.js, Remix, and Express adapters |
|
|
252
|
+
| [`@power-seo/links`](https://www.npmjs.com/package/@power-seo/links) | `npm i @power-seo/links` | Link graph analysis — orphan detection, suggestions, equity scoring |
|
|
253
|
+
| [`@power-seo/audit`](https://www.npmjs.com/package/@power-seo/audit) | `npm i @power-seo/audit` | Full SEO audit engine — meta, content, structure, performance rules |
|
|
254
|
+
| [`@power-seo/images`](https://www.npmjs.com/package/@power-seo/images) | `npm i @power-seo/images` | Image SEO — alt text, lazy loading, format analysis, image sitemaps |
|
|
255
|
+
| [`@power-seo/ai`](https://www.npmjs.com/package/@power-seo/ai) | `npm i @power-seo/ai` | LLM-agnostic AI prompt templates and parsers for SEO tasks |
|
|
256
|
+
| [`@power-seo/analytics`](https://www.npmjs.com/package/@power-seo/analytics) | `npm i @power-seo/analytics` | Merge GSC + audit data, trend analysis, ranking insights, dashboard |
|
|
257
|
+
| [`@power-seo/search-console`](https://www.npmjs.com/package/@power-seo/search-console) | `npm i @power-seo/search-console` | Google Search Console API — OAuth2, service account, URL inspection |
|
|
258
|
+
| [`@power-seo/integrations`](https://www.npmjs.com/package/@power-seo/integrations) | `npm i @power-seo/integrations` | Semrush and Ahrefs API clients with rate limiting and pagination |
|
|
259
|
+
| [`@power-seo/tracking`](https://www.npmjs.com/package/@power-seo/tracking) | `npm i @power-seo/tracking` | GA4, Clarity, PostHog, Plausible, Fathom — scripts + consent management |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## About CyberCraft Bangladesh
|
|
264
|
+
|
|
265
|
+
**CyberCraft Bangladesh** is a Bangladesh-based enterprise-grade software engineering company specializing in ERP system development, AI-powered SaaS and business applications, full-stack SEO services, custom website development, and scalable eCommerce platforms. We design and develop intelligent, automation-driven SaaS and enterprise solutions that help startups, SMEs, NGOs, educational institutes, and large organizations streamline operations, enhance digital visibility, and accelerate growth through modern cloud-native technologies.
|
|
266
|
+
|
|
267
|
+
| | |
|
|
268
|
+
|---|---|
|
|
269
|
+
| **Website** | [ccbd.dev](https://ccbd.dev) |
|
|
270
|
+
| **GitHub** | [github.com/cybercraftbd](https://github.com/cybercraftbd) |
|
|
271
|
+
| **npm Organization** | [npmjs.com/org/power-seo](https://www.npmjs.com/org/power-seo) |
|
|
272
|
+
| **Email** | [info@ccbd.dev](mailto:info@ccbd.dev) |
|
|
273
|
+
|
|
274
|
+
© 2026 CyberCraft Bangladesh · Released under the [MIT License](../../LICENSE)
|