@rankcli/agent-runtime 0.0.1
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 +242 -0
- package/dist/analyzer-2CSWIQGD.mjs +6 -0
- package/dist/chunk-YNZYHEYM.mjs +774 -0
- package/dist/index.d.mts +4012 -0
- package/dist/index.d.ts +4012 -0
- package/dist/index.js +29672 -0
- package/dist/index.mjs +28602 -0
- package/package.json +53 -0
- package/scripts/build-deno.ts +134 -0
- package/src/audit/ai/analyzer.ts +347 -0
- package/src/audit/ai/index.ts +29 -0
- package/src/audit/ai/prompts/content-analysis.ts +271 -0
- package/src/audit/ai/types.ts +179 -0
- package/src/audit/checks/additional-checks.ts +439 -0
- package/src/audit/checks/ai-citation-worthiness.ts +399 -0
- package/src/audit/checks/ai-content-structure.ts +325 -0
- package/src/audit/checks/ai-readiness.ts +339 -0
- package/src/audit/checks/anchor-text.ts +179 -0
- package/src/audit/checks/answer-conciseness.ts +322 -0
- package/src/audit/checks/asset-minification.ts +270 -0
- package/src/audit/checks/bing-optimization.ts +206 -0
- package/src/audit/checks/brand-mention-optimization.ts +349 -0
- package/src/audit/checks/caching-headers.ts +305 -0
- package/src/audit/checks/canonical-advanced.ts +150 -0
- package/src/audit/checks/canonical-domain.ts +196 -0
- package/src/audit/checks/citation-quality.ts +358 -0
- package/src/audit/checks/client-rendering.ts +542 -0
- package/src/audit/checks/color-contrast.ts +342 -0
- package/src/audit/checks/content-freshness.ts +170 -0
- package/src/audit/checks/content-science.ts +589 -0
- package/src/audit/checks/conversion-elements.ts +526 -0
- package/src/audit/checks/crawlability.ts +220 -0
- package/src/audit/checks/directory-listing.ts +172 -0
- package/src/audit/checks/dom-analysis.ts +191 -0
- package/src/audit/checks/dom-size.ts +246 -0
- package/src/audit/checks/duplicate-content.ts +194 -0
- package/src/audit/checks/eeat-signals.ts +990 -0
- package/src/audit/checks/entity-seo.ts +396 -0
- package/src/audit/checks/featured-snippet.ts +473 -0
- package/src/audit/checks/freshness-signals.ts +443 -0
- package/src/audit/checks/funnel-intent.ts +463 -0
- package/src/audit/checks/hreflang.ts +174 -0
- package/src/audit/checks/html-compliance.ts +302 -0
- package/src/audit/checks/image-dimensions.ts +167 -0
- package/src/audit/checks/images.ts +160 -0
- package/src/audit/checks/indexnow.ts +275 -0
- package/src/audit/checks/interactive-tools.ts +475 -0
- package/src/audit/checks/internal-link-graph.ts +436 -0
- package/src/audit/checks/keyword-analysis.ts +239 -0
- package/src/audit/checks/keyword-cannibalization.ts +385 -0
- package/src/audit/checks/keyword-placement.ts +471 -0
- package/src/audit/checks/links.ts +203 -0
- package/src/audit/checks/llms-txt.ts +224 -0
- package/src/audit/checks/local-seo.ts +296 -0
- package/src/audit/checks/mobile.ts +167 -0
- package/src/audit/checks/modern-images.ts +226 -0
- package/src/audit/checks/navboost-signals.ts +395 -0
- package/src/audit/checks/on-page.ts +209 -0
- package/src/audit/checks/page-resources.ts +285 -0
- package/src/audit/checks/pagination.ts +180 -0
- package/src/audit/checks/performance.ts +153 -0
- package/src/audit/checks/platform-presence.ts +580 -0
- package/src/audit/checks/redirect-analysis.ts +153 -0
- package/src/audit/checks/redirect-chain.ts +389 -0
- package/src/audit/checks/resource-hints.ts +420 -0
- package/src/audit/checks/responsive-css.ts +247 -0
- package/src/audit/checks/responsive-images.ts +396 -0
- package/src/audit/checks/review-ecosystem.ts +415 -0
- package/src/audit/checks/robots-validation.ts +373 -0
- package/src/audit/checks/security-headers.ts +172 -0
- package/src/audit/checks/security.ts +144 -0
- package/src/audit/checks/serp-preview.ts +251 -0
- package/src/audit/checks/site-maturity.ts +444 -0
- package/src/audit/checks/social-meta.test.ts +275 -0
- package/src/audit/checks/social-meta.ts +134 -0
- package/src/audit/checks/soft-404.ts +151 -0
- package/src/audit/checks/structured-data.ts +238 -0
- package/src/audit/checks/tech-detection.ts +496 -0
- package/src/audit/checks/topical-clusters.ts +435 -0
- package/src/audit/checks/tracker-bloat.ts +462 -0
- package/src/audit/checks/tracking-verification.test.ts +371 -0
- package/src/audit/checks/tracking-verification.ts +636 -0
- package/src/audit/checks/url-safety.ts +682 -0
- package/src/audit/deno-entry.ts +66 -0
- package/src/audit/discovery/index.ts +15 -0
- package/src/audit/discovery/link-crawler.ts +232 -0
- package/src/audit/discovery/repo-routes.ts +347 -0
- package/src/audit/engine.ts +620 -0
- package/src/audit/fixes/index.ts +209 -0
- package/src/audit/fixes/social-meta-fixes.test.ts +329 -0
- package/src/audit/fixes/social-meta-fixes.ts +463 -0
- package/src/audit/index.ts +74 -0
- package/src/audit/runner.test.ts +299 -0
- package/src/audit/runner.ts +130 -0
- package/src/audit/types.ts +1953 -0
- package/src/content/featured-snippet.ts +367 -0
- package/src/content/generator.test.ts +534 -0
- package/src/content/generator.ts +501 -0
- package/src/content/headline.ts +317 -0
- package/src/content/index.ts +62 -0
- package/src/content/intent.ts +258 -0
- package/src/content/keyword-density.ts +349 -0
- package/src/content/readability.ts +262 -0
- package/src/executor.ts +336 -0
- package/src/fixer.ts +416 -0
- package/src/frameworks/detector.test.ts +248 -0
- package/src/frameworks/detector.ts +371 -0
- package/src/frameworks/index.ts +68 -0
- package/src/frameworks/recipes/angular.yaml +171 -0
- package/src/frameworks/recipes/astro.yaml +206 -0
- package/src/frameworks/recipes/django.yaml +180 -0
- package/src/frameworks/recipes/laravel.yaml +137 -0
- package/src/frameworks/recipes/nextjs.yaml +268 -0
- package/src/frameworks/recipes/nuxt.yaml +175 -0
- package/src/frameworks/recipes/rails.yaml +188 -0
- package/src/frameworks/recipes/react.yaml +202 -0
- package/src/frameworks/recipes/sveltekit.yaml +154 -0
- package/src/frameworks/recipes/vue.yaml +137 -0
- package/src/frameworks/recipes/wordpress.yaml +209 -0
- package/src/frameworks/suggestion-engine.ts +320 -0
- package/src/geo/geo-content.test.ts +305 -0
- package/src/geo/geo-content.ts +266 -0
- package/src/geo/geo-history.test.ts +473 -0
- package/src/geo/geo-history.ts +433 -0
- package/src/geo/geo-tracker.test.ts +359 -0
- package/src/geo/geo-tracker.ts +411 -0
- package/src/geo/index.ts +10 -0
- package/src/git/commit-helper.test.ts +261 -0
- package/src/git/commit-helper.ts +329 -0
- package/src/git/index.ts +12 -0
- package/src/git/pr-helper.test.ts +284 -0
- package/src/git/pr-helper.ts +307 -0
- package/src/index.ts +66 -0
- package/src/keywords/ai-keyword-engine.ts +1062 -0
- package/src/keywords/ai-summarizer.ts +387 -0
- package/src/keywords/ci-mode.ts +555 -0
- package/src/keywords/engine.ts +359 -0
- package/src/keywords/index.ts +151 -0
- package/src/keywords/llm-judge.ts +357 -0
- package/src/keywords/nlp-analysis.ts +706 -0
- package/src/keywords/prioritizer.ts +295 -0
- package/src/keywords/site-crawler.ts +342 -0
- package/src/keywords/sources/autocomplete.ts +139 -0
- package/src/keywords/sources/competitive-search.ts +450 -0
- package/src/keywords/sources/competitor-analysis.ts +374 -0
- package/src/keywords/sources/dataforseo.ts +206 -0
- package/src/keywords/sources/free-sources.ts +294 -0
- package/src/keywords/sources/gsc.ts +123 -0
- package/src/keywords/topic-grouping.ts +327 -0
- package/src/keywords/types.ts +144 -0
- package/src/keywords/wizard.ts +457 -0
- package/src/loader.ts +40 -0
- package/src/reports/index.ts +7 -0
- package/src/reports/report-generator.test.ts +293 -0
- package/src/reports/report-generator.ts +713 -0
- package/src/scheduler/alerts.test.ts +458 -0
- package/src/scheduler/alerts.ts +328 -0
- package/src/scheduler/index.ts +8 -0
- package/src/scheduler/scheduled-audit.test.ts +377 -0
- package/src/scheduler/scheduled-audit.ts +149 -0
- package/src/test/integration-test.ts +325 -0
- package/src/tools/analyzer.ts +373 -0
- package/src/tools/crawl.ts +293 -0
- package/src/tools/files.ts +301 -0
- package/src/tools/h1-fixer.ts +249 -0
- package/src/tools/index.ts +67 -0
- package/src/tracking/github-action.ts +326 -0
- package/src/tracking/google-analytics.ts +265 -0
- package/src/tracking/index.ts +45 -0
- package/src/tracking/report-generator.ts +386 -0
- package/src/tracking/search-console.ts +335 -0
- package/src/types.ts +134 -0
- package/src/utils/http.ts +302 -0
- package/src/wasm-adapter.ts +297 -0
- package/src/wasm-entry.ts +14 -0
- package/tsconfig.json +17 -0
- package/tsup.wasm.config.ts +26 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Astro SEO Recipe
|
|
2
|
+
# Astro is SEO-first by design - zero JS by default, excellent for content sites
|
|
3
|
+
|
|
4
|
+
framework: astro
|
|
5
|
+
display_name: Astro
|
|
6
|
+
category: static-first
|
|
7
|
+
ssr_default: false # Static by default, SSR optional
|
|
8
|
+
|
|
9
|
+
seo_strengths:
|
|
10
|
+
- "Zero JavaScript by default"
|
|
11
|
+
- "Static HTML output"
|
|
12
|
+
- "Excellent performance (100 Lighthouse)"
|
|
13
|
+
- "Content Collections for organized content"
|
|
14
|
+
- "Built-in sitemap and RSS integrations"
|
|
15
|
+
- "Partial hydration (Islands Architecture)"
|
|
16
|
+
|
|
17
|
+
checks:
|
|
18
|
+
- code: ASTRO_NO_SITEMAP
|
|
19
|
+
severity: warning
|
|
20
|
+
title: "Missing sitemap integration"
|
|
21
|
+
description: "Astro has a built-in sitemap integration."
|
|
22
|
+
howToFix: |
|
|
23
|
+
Add the sitemap integration:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx astro add sitemap
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Configure in astro.config.mjs:
|
|
30
|
+
```js
|
|
31
|
+
import sitemap from '@astrojs/sitemap';
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
site: 'https://yoursite.com',
|
|
35
|
+
integrations: [sitemap()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- code: ASTRO_NO_SITE_CONFIG
|
|
40
|
+
severity: error
|
|
41
|
+
title: "Missing site URL configuration"
|
|
42
|
+
description: "The site URL is required for sitemap and canonical URLs."
|
|
43
|
+
howToFix: |
|
|
44
|
+
Add site to astro.config.mjs:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
site: 'https://yoursite.com',
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- code: ASTRO_CLIENT_DIRECTIVE_OVERUSE
|
|
53
|
+
severity: warning
|
|
54
|
+
title: "Overusing client: directives"
|
|
55
|
+
description: "Too many client-side components reduce Astro's performance benefits."
|
|
56
|
+
howToFix: |
|
|
57
|
+
Only hydrate components that need interactivity:
|
|
58
|
+
|
|
59
|
+
```astro
|
|
60
|
+
<!-- Bad - unnecessary JS -->
|
|
61
|
+
<StaticCard client:load />
|
|
62
|
+
|
|
63
|
+
<!-- Good - no JS for static content -->
|
|
64
|
+
<StaticCard />
|
|
65
|
+
|
|
66
|
+
<!-- Good - only hydrate when needed -->
|
|
67
|
+
<InteractiveWidget client:visible />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Prefer client:visible over client:load for below-fold content.
|
|
71
|
+
|
|
72
|
+
- code: ASTRO_NO_BASE_LAYOUT
|
|
73
|
+
severity: notice
|
|
74
|
+
title: "Pages missing base layout"
|
|
75
|
+
description: "Using a shared layout ensures consistent SEO tags."
|
|
76
|
+
howToFix: |
|
|
77
|
+
Create a BaseLayout.astro:
|
|
78
|
+
|
|
79
|
+
```astro
|
|
80
|
+
---
|
|
81
|
+
// src/layouts/BaseLayout.astro
|
|
82
|
+
interface Props {
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
}
|
|
86
|
+
const { title, description } = Astro.props;
|
|
87
|
+
---
|
|
88
|
+
<html lang="en">
|
|
89
|
+
<head>
|
|
90
|
+
<meta charset="UTF-8" />
|
|
91
|
+
<meta name="viewport" content="width=device-width" />
|
|
92
|
+
<title>{title}</title>
|
|
93
|
+
<meta name="description" content={description} />
|
|
94
|
+
<link rel="canonical" href={Astro.url} />
|
|
95
|
+
</head>
|
|
96
|
+
<body>
|
|
97
|
+
<slot />
|
|
98
|
+
</body>
|
|
99
|
+
</html>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- code: ASTRO_NO_ASTRO_SEO
|
|
103
|
+
severity: notice
|
|
104
|
+
title: "Not using @astrolib/seo"
|
|
105
|
+
description: "The astro-seo package provides comprehensive SEO components."
|
|
106
|
+
howToFix: |
|
|
107
|
+
Install astro-seo:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm install astro-seo
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```astro
|
|
114
|
+
---
|
|
115
|
+
import { SEO } from 'astro-seo';
|
|
116
|
+
---
|
|
117
|
+
<SEO
|
|
118
|
+
title="Page Title"
|
|
119
|
+
description="Description"
|
|
120
|
+
openGraph={{
|
|
121
|
+
basic: {
|
|
122
|
+
title: "OG Title",
|
|
123
|
+
type: "website",
|
|
124
|
+
image: "/og-image.jpg",
|
|
125
|
+
}
|
|
126
|
+
}}
|
|
127
|
+
twitter={{
|
|
128
|
+
creator: "@handle"
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- code: ASTRO_IMAGE_NOT_OPTIMIZED
|
|
134
|
+
severity: warning
|
|
135
|
+
title: "Images not using Astro Image"
|
|
136
|
+
description: "Use Astro's built-in Image component for optimization."
|
|
137
|
+
howToFix: |
|
|
138
|
+
Use the Image component:
|
|
139
|
+
|
|
140
|
+
```astro
|
|
141
|
+
---
|
|
142
|
+
import { Image } from 'astro:assets';
|
|
143
|
+
import heroImage from '../assets/hero.jpg';
|
|
144
|
+
---
|
|
145
|
+
<Image
|
|
146
|
+
src={heroImage}
|
|
147
|
+
alt="Hero"
|
|
148
|
+
width={1200}
|
|
149
|
+
height={630}
|
|
150
|
+
loading="eager"
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- code: ASTRO_NO_CONTENT_COLLECTIONS
|
|
155
|
+
severity: notice
|
|
156
|
+
title: "Not using Content Collections"
|
|
157
|
+
description: "Content Collections provide type-safe content with built-in frontmatter validation."
|
|
158
|
+
howToFix: |
|
|
159
|
+
Define a collection in src/content/config.ts:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { defineCollection, z } from 'astro:content';
|
|
163
|
+
|
|
164
|
+
const blog = defineCollection({
|
|
165
|
+
schema: z.object({
|
|
166
|
+
title: z.string(),
|
|
167
|
+
description: z.string(),
|
|
168
|
+
pubDate: z.date(),
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const collections = { blog };
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
- code: ASTRO_SSR_OVERUSE
|
|
176
|
+
severity: notice
|
|
177
|
+
title: "Using SSR when static would work"
|
|
178
|
+
description: "Static pages are faster and cheaper to host."
|
|
179
|
+
howToFix: |
|
|
180
|
+
Use prerender for pages that don't need SSR:
|
|
181
|
+
|
|
182
|
+
```astro
|
|
183
|
+
---
|
|
184
|
+
export const prerender = true; // Static generation
|
|
185
|
+
---
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Or set default to static in config:
|
|
189
|
+
```js
|
|
190
|
+
export default defineConfig({
|
|
191
|
+
output: 'hybrid', // Static by default, SSR opt-in
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
performance_tips:
|
|
196
|
+
- "Use client:visible instead of client:load for below-fold components"
|
|
197
|
+
- "Leverage Content Collections for type-safe content"
|
|
198
|
+
- "Use View Transitions for smooth navigation"
|
|
199
|
+
- "Optimize images with astro:assets"
|
|
200
|
+
- "Consider using Astro DB for dynamic content"
|
|
201
|
+
|
|
202
|
+
integrations:
|
|
203
|
+
- "@astrojs/sitemap - Automatic sitemap generation"
|
|
204
|
+
- "@astrojs/rss - RSS feed for blogs"
|
|
205
|
+
- "astro-seo - Comprehensive SEO component"
|
|
206
|
+
- "@astrojs/partytown - Move third-party scripts to web worker"
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Django SEO Recipe
|
|
2
|
+
# Django is the most popular Python web framework
|
|
3
|
+
|
|
4
|
+
framework: django
|
|
5
|
+
display_name: Django
|
|
6
|
+
category: server-rendered
|
|
7
|
+
ssr_default: true
|
|
8
|
+
|
|
9
|
+
seo_strengths:
|
|
10
|
+
- "Server-rendered HTML by default"
|
|
11
|
+
- "Built-in sitemap framework"
|
|
12
|
+
- "Admin interface for content management"
|
|
13
|
+
- "Mature ecosystem"
|
|
14
|
+
|
|
15
|
+
checks:
|
|
16
|
+
- code: DJANGO_NO_SITEMAP
|
|
17
|
+
severity: warning
|
|
18
|
+
title: "Django sitemap framework not configured"
|
|
19
|
+
description: "Django has a built-in sitemap framework that should be used."
|
|
20
|
+
howToFix: |
|
|
21
|
+
Add sitemap to your project:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
# settings.py
|
|
25
|
+
INSTALLED_APPS = [
|
|
26
|
+
'django.contrib.sitemaps',
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
# sitemaps.py
|
|
30
|
+
from django.contrib.sitemaps import Sitemap
|
|
31
|
+
from .models import Post
|
|
32
|
+
|
|
33
|
+
class PostSitemap(Sitemap):
|
|
34
|
+
changefreq = "weekly"
|
|
35
|
+
priority = 0.8
|
|
36
|
+
|
|
37
|
+
def items(self):
|
|
38
|
+
return Post.objects.filter(published=True)
|
|
39
|
+
|
|
40
|
+
def lastmod(self, obj):
|
|
41
|
+
return obj.updated_at
|
|
42
|
+
|
|
43
|
+
# urls.py
|
|
44
|
+
from django.contrib.sitemaps.views import sitemap
|
|
45
|
+
from .sitemaps import PostSitemap
|
|
46
|
+
|
|
47
|
+
sitemaps = {'posts': PostSitemap}
|
|
48
|
+
|
|
49
|
+
urlpatterns = [
|
|
50
|
+
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}),
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- code: DJANGO_NO_META_FRAMEWORK
|
|
55
|
+
severity: warning
|
|
56
|
+
title: "No SEO meta framework detected"
|
|
57
|
+
description: "Use django-meta for consistent meta tag management."
|
|
58
|
+
howToFix: |
|
|
59
|
+
Install django-meta:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install django-meta
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
# settings.py
|
|
67
|
+
INSTALLED_APPS = ['meta']
|
|
68
|
+
|
|
69
|
+
META_SITE_PROTOCOL = 'https'
|
|
70
|
+
META_USE_OG_PROPERTIES = True
|
|
71
|
+
META_USE_TWITTER_PROPERTIES = True
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
# In views or models
|
|
76
|
+
from meta.views import MetadataMixin
|
|
77
|
+
|
|
78
|
+
class PostDetailView(MetadataMixin, DetailView):
|
|
79
|
+
def get_meta_title(self):
|
|
80
|
+
return self.object.title
|
|
81
|
+
|
|
82
|
+
def get_meta_description(self):
|
|
83
|
+
return self.object.excerpt
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- code: DJANGO_DEBUG_TRUE
|
|
87
|
+
severity: error
|
|
88
|
+
title: "DEBUG mode appears enabled"
|
|
89
|
+
description: "DEBUG=True in production exposes sensitive information and hurts performance."
|
|
90
|
+
howToFix: |
|
|
91
|
+
Ensure DEBUG is False in production:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
# settings.py
|
|
95
|
+
DEBUG = os.environ.get('DEBUG', 'False') == 'True'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Or use django-environ:
|
|
99
|
+
```python
|
|
100
|
+
import environ
|
|
101
|
+
env = environ.Env(DEBUG=(bool, False))
|
|
102
|
+
DEBUG = env('DEBUG')
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- code: DJANGO_NO_CACHE
|
|
106
|
+
severity: warning
|
|
107
|
+
title: "Caching not configured"
|
|
108
|
+
description: "Django without caching is slower than it should be."
|
|
109
|
+
howToFix: |
|
|
110
|
+
Configure caching in settings.py:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
# Redis (recommended)
|
|
114
|
+
CACHES = {
|
|
115
|
+
'default': {
|
|
116
|
+
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
|
117
|
+
'LOCATION': 'redis://127.0.0.1:6379',
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# Use cache in views
|
|
122
|
+
from django.views.decorators.cache import cache_page
|
|
123
|
+
|
|
124
|
+
@cache_page(60 * 15) # 15 minutes
|
|
125
|
+
def my_view(request):
|
|
126
|
+
...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- code: DJANGO_NO_GZIP
|
|
130
|
+
severity: notice
|
|
131
|
+
title: "GZip middleware not enabled"
|
|
132
|
+
description: "Enable GZip compression for faster page loads."
|
|
133
|
+
howToFix: |
|
|
134
|
+
Add GZip middleware:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
# settings.py
|
|
138
|
+
MIDDLEWARE = [
|
|
139
|
+
'django.middleware.gzip.GZipMiddleware',
|
|
140
|
+
# ... other middleware
|
|
141
|
+
]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- code: DJANGO_NO_WHITENOISE
|
|
145
|
+
severity: notice
|
|
146
|
+
title: "Static files not optimized"
|
|
147
|
+
description: "Use WhiteNoise for efficient static file serving."
|
|
148
|
+
howToFix: |
|
|
149
|
+
Install and configure WhiteNoise:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install whitenoise
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
# settings.py
|
|
157
|
+
MIDDLEWARE = [
|
|
158
|
+
'django.middleware.security.SecurityMiddleware',
|
|
159
|
+
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
160
|
+
# ...
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
performance_tips:
|
|
167
|
+
- "Use select_related/prefetch_related for queries"
|
|
168
|
+
- "Enable template caching in production"
|
|
169
|
+
- "Use django-debug-toolbar in development"
|
|
170
|
+
- "Configure database connection pooling"
|
|
171
|
+
- "Use async views for I/O-bound operations (Django 4.1+)"
|
|
172
|
+
|
|
173
|
+
recommended_packages:
|
|
174
|
+
seo:
|
|
175
|
+
- "django-meta - Meta tag management"
|
|
176
|
+
- "django-robots - robots.txt management"
|
|
177
|
+
performance:
|
|
178
|
+
- "django-redis - Redis caching"
|
|
179
|
+
- "whitenoise - Static file serving"
|
|
180
|
+
- "django-debug-toolbar - Development profiling"
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Laravel SEO Recipe
|
|
2
|
+
# Laravel is the most popular PHP framework
|
|
3
|
+
|
|
4
|
+
framework: laravel
|
|
5
|
+
display_name: Laravel
|
|
6
|
+
category: server-rendered
|
|
7
|
+
ssr_default: true
|
|
8
|
+
|
|
9
|
+
seo_strengths:
|
|
10
|
+
- "Server-rendered HTML by default"
|
|
11
|
+
- "Blade templates for clean SEO markup"
|
|
12
|
+
- "Route caching for fast responses"
|
|
13
|
+
- "Built-in CSRF and security"
|
|
14
|
+
|
|
15
|
+
checks:
|
|
16
|
+
- code: LARAVEL_NO_META_PACKAGE
|
|
17
|
+
severity: warning
|
|
18
|
+
title: "No SEO package detected"
|
|
19
|
+
description: "Laravel benefits from an SEO package like artesaos/seotools."
|
|
20
|
+
howToFix: |
|
|
21
|
+
Install artesaos/seotools:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
composer require artesaos/seotools
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```php
|
|
28
|
+
// In controller
|
|
29
|
+
use Artesaos\SEOTools\Facades\SEOMeta;
|
|
30
|
+
|
|
31
|
+
SEOMeta::setTitle('Page Title');
|
|
32
|
+
SEOMeta::setDescription('Description');
|
|
33
|
+
|
|
34
|
+
// In Blade
|
|
35
|
+
{!! SEOMeta::generate() !!}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- code: LARAVEL_NO_SITEMAP
|
|
39
|
+
severity: warning
|
|
40
|
+
title: "No sitemap package detected"
|
|
41
|
+
description: "Use spatie/laravel-sitemap for automatic sitemaps."
|
|
42
|
+
howToFix: |
|
|
43
|
+
```bash
|
|
44
|
+
composer require spatie/laravel-sitemap
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```php
|
|
48
|
+
// Generate sitemap
|
|
49
|
+
use Spatie\Sitemap\SitemapGenerator;
|
|
50
|
+
|
|
51
|
+
SitemapGenerator::create('https://yoursite.com')
|
|
52
|
+
->writeToFile(public_path('sitemap.xml'));
|
|
53
|
+
|
|
54
|
+
// Or build manually
|
|
55
|
+
use Spatie\Sitemap\Sitemap;
|
|
56
|
+
use Spatie\Sitemap\Tags\Url;
|
|
57
|
+
|
|
58
|
+
Sitemap::create()
|
|
59
|
+
->add(Url::create('/')->setPriority(1.0))
|
|
60
|
+
->add(Url::create('/about'))
|
|
61
|
+
->writeToFile(public_path('sitemap.xml'));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- code: LARAVEL_INERTIA_NO_SSR
|
|
65
|
+
severity: error
|
|
66
|
+
title: "Inertia.js without SSR"
|
|
67
|
+
description: "Inertia apps are client-rendered by default, losing SEO benefits."
|
|
68
|
+
howToFix: |
|
|
69
|
+
Enable Inertia SSR:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
php artisan inertia:start-ssr
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Configure in config/inertia.php:
|
|
76
|
+
```php
|
|
77
|
+
'ssr' => [
|
|
78
|
+
'enabled' => true,
|
|
79
|
+
'url' => 'http://127.0.0.1:13714',
|
|
80
|
+
],
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- code: LARAVEL_NO_RESPONSE_CACHE
|
|
84
|
+
severity: notice
|
|
85
|
+
title: "Response caching not configured"
|
|
86
|
+
description: "Cache full responses for better performance."
|
|
87
|
+
howToFix: |
|
|
88
|
+
Install spatie/laravel-responsecache:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
composer require spatie/laravel-responsecache
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Add middleware:
|
|
95
|
+
```php
|
|
96
|
+
// app/Http/Kernel.php
|
|
97
|
+
protected $middlewareGroups = [
|
|
98
|
+
'web' => [
|
|
99
|
+
\Spatie\ResponseCache\Middlewares\CacheResponse::class,
|
|
100
|
+
],
|
|
101
|
+
];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- code: LARAVEL_LIVEWIRE_SEO
|
|
105
|
+
severity: warning
|
|
106
|
+
title: "Livewire components may affect SEO"
|
|
107
|
+
description: "Livewire content loads via JavaScript after initial page load."
|
|
108
|
+
howToFix: |
|
|
109
|
+
For SEO-critical content, use wire:init to load immediately:
|
|
110
|
+
|
|
111
|
+
```blade
|
|
112
|
+
<div wire:init="loadData">
|
|
113
|
+
@if($data)
|
|
114
|
+
{{-- Content --}}
|
|
115
|
+
@else
|
|
116
|
+
{{-- Loading skeleton --}}
|
|
117
|
+
@endif
|
|
118
|
+
</div>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or use Alpine.js for client-only interactions.
|
|
122
|
+
|
|
123
|
+
performance_tips:
|
|
124
|
+
- "Enable route caching: php artisan route:cache"
|
|
125
|
+
- "Enable config caching: php artisan config:cache"
|
|
126
|
+
- "Use query caching with remember()"
|
|
127
|
+
- "Optimize autoloader: composer dump-autoload -o"
|
|
128
|
+
- "Use Laravel Octane for high performance"
|
|
129
|
+
|
|
130
|
+
recommended_packages:
|
|
131
|
+
seo:
|
|
132
|
+
- "artesaos/seotools - Meta tag management"
|
|
133
|
+
- "spatie/laravel-sitemap - Sitemap generation"
|
|
134
|
+
- "spatie/schema-org - Structured data"
|
|
135
|
+
performance:
|
|
136
|
+
- "spatie/laravel-responsecache - Full page caching"
|
|
137
|
+
- "barryvdh/laravel-debugbar - Development profiling"
|