@djangocfg/seo 2.1.50
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 +192 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +3780 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/crawler/index.d.ts +88 -0
- package/dist/crawler/index.mjs +610 -0
- package/dist/crawler/index.mjs.map +1 -0
- package/dist/google-console/index.d.ts +95 -0
- package/dist/google-console/index.mjs +539 -0
- package/dist/google-console/index.mjs.map +1 -0
- package/dist/index.d.ts +285 -0
- package/dist/index.mjs +3236 -0
- package/dist/index.mjs.map +1 -0
- package/dist/link-checker/index.d.ts +76 -0
- package/dist/link-checker/index.mjs +326 -0
- package/dist/link-checker/index.mjs.map +1 -0
- package/dist/markdown-report-B3QdDzxE.d.ts +193 -0
- package/dist/reports/index.d.ts +24 -0
- package/dist/reports/index.mjs +836 -0
- package/dist/reports/index.mjs.map +1 -0
- package/dist/routes/index.d.ts +69 -0
- package/dist/routes/index.mjs +372 -0
- package/dist/routes/index.mjs.map +1 -0
- package/dist/scanner-Cz4Th2Pt.d.ts +60 -0
- package/dist/types/index.d.ts +144 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +114 -0
- package/src/analyzer.ts +256 -0
- package/src/cli/commands/audit.ts +260 -0
- package/src/cli/commands/content.ts +180 -0
- package/src/cli/commands/crawl.ts +32 -0
- package/src/cli/commands/index.ts +12 -0
- package/src/cli/commands/inspect.ts +60 -0
- package/src/cli/commands/links.ts +41 -0
- package/src/cli/commands/robots.ts +36 -0
- package/src/cli/commands/routes.ts +126 -0
- package/src/cli/commands/sitemap.ts +48 -0
- package/src/cli/index.ts +149 -0
- package/src/cli/types.ts +40 -0
- package/src/config.ts +207 -0
- package/src/content/index.ts +51 -0
- package/src/content/link-checker.ts +182 -0
- package/src/content/link-fixer.ts +188 -0
- package/src/content/scanner.ts +200 -0
- package/src/content/sitemap-generator.ts +321 -0
- package/src/content/types.ts +140 -0
- package/src/crawler/crawler.ts +425 -0
- package/src/crawler/index.ts +10 -0
- package/src/crawler/robots-parser.ts +171 -0
- package/src/crawler/sitemap-validator.ts +204 -0
- package/src/google-console/analyzer.ts +317 -0
- package/src/google-console/auth.ts +100 -0
- package/src/google-console/client.ts +281 -0
- package/src/google-console/index.ts +9 -0
- package/src/index.ts +144 -0
- package/src/link-checker/index.ts +461 -0
- package/src/reports/claude-context.ts +149 -0
- package/src/reports/generator.ts +244 -0
- package/src/reports/index.ts +27 -0
- package/src/reports/json-report.ts +320 -0
- package/src/reports/markdown-report.ts +246 -0
- package/src/reports/split-report.ts +252 -0
- package/src/routes/analyzer.ts +324 -0
- package/src/routes/index.ts +25 -0
- package/src/routes/scanner.ts +298 -0
- package/src/types/index.ts +222 -0
- package/src/utils/index.ts +154 -0
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# @djangocfg/seo
|
|
2
|
+
|
|
3
|
+
SEO audit toolkit for Next.js App Router. Parallel execution, AI-ready split reports.
|
|
4
|
+
|
|
5
|
+
**Part of [DjangoCFG](https://djangocfg.com)** — modern Django framework for production-ready SaaS applications.
|
|
6
|
+
|
|
7
|
+
## Two Modes
|
|
8
|
+
|
|
9
|
+
| Mode | Target | Use Case |
|
|
10
|
+
|------|--------|----------|
|
|
11
|
+
| **Audit** (HTTP) | Live site | Production SEO check, broken links, GSC data |
|
|
12
|
+
| **Content** (files) | `content/` dir | MDX link validation, sitemap generation |
|
|
13
|
+
|
|
14
|
+
**Audit** — crawls your deployed site via HTTP. Use for production audits.
|
|
15
|
+
|
|
16
|
+
**Content** — scans local MDX files in `content/` directory. Use for Nextra/docs projects to validate links before deploy and generate `sitemap.ts`.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @djangocfg/seo
|
|
22
|
+
|
|
23
|
+
# Full SEO audit
|
|
24
|
+
djangocfg-seo audit
|
|
25
|
+
|
|
26
|
+
# Scan app/ routes and compare with sitemap
|
|
27
|
+
djangocfg-seo routes --check
|
|
28
|
+
|
|
29
|
+
# Check broken links
|
|
30
|
+
djangocfg-seo links
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
| Command | Description |
|
|
36
|
+
|---------|-------------|
|
|
37
|
+
| `audit` | Full audit (robots + sitemap + crawl + links + routes + GSC) |
|
|
38
|
+
| `routes` | Scan app/ directory, compare with sitemap |
|
|
39
|
+
| `crawl` | Crawl site, analyze meta/titles/H1 |
|
|
40
|
+
| `links` | Check for broken links |
|
|
41
|
+
| `robots` | Analyze robots.txt |
|
|
42
|
+
| `sitemap` | Validate sitemap.xml |
|
|
43
|
+
| `inspect` | GSC URL inspection |
|
|
44
|
+
| `content check` | Check MDX links in content/ |
|
|
45
|
+
| `content fix` | Fix absolute → relative links |
|
|
46
|
+
| `content sitemap` | Generate sitemap.ts from content/ |
|
|
47
|
+
|
|
48
|
+
## Options
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
--env, -e prod (default) or dev
|
|
52
|
+
--site, -s Site URL (overrides env)
|
|
53
|
+
--output, -o Output directory (default: ./seo-reports)
|
|
54
|
+
--format, -f split (default), json, markdown, ai-summary, all
|
|
55
|
+
--max-pages Max pages to crawl (default: 100)
|
|
56
|
+
--service-account Google service account JSON path
|
|
57
|
+
--app-dir Path to app/ directory
|
|
58
|
+
--check Compare routes with sitemap
|
|
59
|
+
--verify Verify routes are accessible
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Routes Command
|
|
63
|
+
|
|
64
|
+
Scans Next.js App Router `app/` directory:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
djangocfg-seo routes # List all routes
|
|
68
|
+
djangocfg-seo routes --check # Compare with sitemap
|
|
69
|
+
djangocfg-seo routes --verify # Verify routes return 200
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Output:
|
|
73
|
+
```
|
|
74
|
+
Routes found: 16
|
|
75
|
+
├── Static: 11
|
|
76
|
+
├── Dynamic: 1
|
|
77
|
+
└── API: 4
|
|
78
|
+
|
|
79
|
+
Sitemap comparison:
|
|
80
|
+
├── Matching: 8
|
|
81
|
+
├── Missing from sitemap: 3
|
|
82
|
+
└── Extra in sitemap: 50
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Handles: route groups `(group)`, dynamic `[slug]`, catch-all `[...slug]`, parallel `@folder`, private `_folder`.
|
|
86
|
+
|
|
87
|
+
## Reports
|
|
88
|
+
|
|
89
|
+
Default `split` format - AI-optimized files under 1000 lines:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
@reports/seo/
|
|
93
|
+
├── CLAUDE.md # AI context file
|
|
94
|
+
├── seo-*-index.md # Summary + links to categories
|
|
95
|
+
├── seo-*-technical.md # Broken links, sitemap, robots.txt
|
|
96
|
+
├── seo-*-content.md # H1, meta, titles
|
|
97
|
+
├── seo-*-performance.md # Load time, TTFB
|
|
98
|
+
└── seo-ai-summary-*.md # Quick overview
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Google Search Console
|
|
102
|
+
|
|
103
|
+
Auto-detects `gsc-key.json` in project root:
|
|
104
|
+
|
|
105
|
+
1. Create service account: [console.cloud.google.com](https://console.cloud.google.com/iam-admin/serviceaccounts/create)
|
|
106
|
+
2. Download JSON key as `gsc-key.json`
|
|
107
|
+
3. Enable API: [searchconsole API](https://console.cloud.google.com/apis/library/searchconsole.googleapis.com)
|
|
108
|
+
4. Add service account email to GSC with Full access
|
|
109
|
+
5. Run audit - GSC data included automatically
|
|
110
|
+
|
|
111
|
+
## Programmatic Usage
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { SiteCrawler, analyzeCrawlResults } from '@djangocfg/seo/crawler';
|
|
115
|
+
import { checkLinks, linkResultsToSeoIssues } from '@djangocfg/seo/link-checker';
|
|
116
|
+
import { scanRoutes, compareWithSitemap } from '@djangocfg/seo/routes';
|
|
117
|
+
import { generateAndSaveReports } from '@djangocfg/seo/reports';
|
|
118
|
+
|
|
119
|
+
// Crawl
|
|
120
|
+
const crawler = new SiteCrawler('https://example.com', { maxPages: 100 });
|
|
121
|
+
const results = await crawler.crawl();
|
|
122
|
+
const crawlIssues = analyzeCrawlResults(results);
|
|
123
|
+
|
|
124
|
+
// Routes
|
|
125
|
+
const routes = scanRoutes({ appDir: './app' });
|
|
126
|
+
console.log(routes.staticRoutes, routes.dynamicRoutes);
|
|
127
|
+
|
|
128
|
+
// Links
|
|
129
|
+
const linkResult = await checkLinks({ url: 'https://example.com' });
|
|
130
|
+
const linkIssues = linkResultsToSeoIssues(linkResult);
|
|
131
|
+
|
|
132
|
+
// Reports
|
|
133
|
+
await generateAndSaveReports('https://example.com', {
|
|
134
|
+
issues: [...crawlIssues, ...linkIssues],
|
|
135
|
+
}, {
|
|
136
|
+
outputDir: './reports',
|
|
137
|
+
formats: ['split'],
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Exports
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// Main
|
|
145
|
+
import { SiteCrawler, checkLinks, GoogleConsoleClient } from '@djangocfg/seo';
|
|
146
|
+
|
|
147
|
+
// Submodules
|
|
148
|
+
import { SiteCrawler, analyzeCrawlResults } from '@djangocfg/seo/crawler';
|
|
149
|
+
import { checkLinks, linkResultsToSeoIssues } from '@djangocfg/seo/link-checker';
|
|
150
|
+
import { scanRoutes, compareWithSitemap, verifyRoutes } from '@djangocfg/seo/routes';
|
|
151
|
+
import { GoogleConsoleClient } from '@djangocfg/seo/google-console';
|
|
152
|
+
import { generateAndSaveReports } from '@djangocfg/seo/reports';
|
|
153
|
+
import type { SeoIssue, SeoReport, CrawlResult } from '@djangocfg/seo/types';
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Issue Types
|
|
157
|
+
|
|
158
|
+
| Severity | Description |
|
|
159
|
+
|----------|-------------|
|
|
160
|
+
| `critical` | Blocks indexing |
|
|
161
|
+
| `error` | SEO problems |
|
|
162
|
+
| `warning` | Recommendations |
|
|
163
|
+
| `info` | Best practices |
|
|
164
|
+
|
|
165
|
+
| Category | Examples |
|
|
166
|
+
|----------|----------|
|
|
167
|
+
| `technical` | Broken links, sitemap, robots.txt |
|
|
168
|
+
| `content` | Missing H1, meta description |
|
|
169
|
+
| `indexing` | Not indexed, crawl errors |
|
|
170
|
+
| `performance` | Slow load time, high TTFB |
|
|
171
|
+
|
|
172
|
+
## Architecture
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
djangocfg-seo audit
|
|
176
|
+
│
|
|
177
|
+
├─ robots.txt → get sitemap URLs
|
|
178
|
+
│
|
|
179
|
+
├─ [PARALLEL] ─┬─ Sitemap
|
|
180
|
+
│ ├─ Crawl (+ TTFB metrics)
|
|
181
|
+
│ └─ Links
|
|
182
|
+
│
|
|
183
|
+
├─ Routes (compare with sitemap)
|
|
184
|
+
│
|
|
185
|
+
└─ GSC (sc-domain:xxx)
|
|
186
|
+
│
|
|
187
|
+
└─ @reports/seo/
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|