create-claudecraft 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/LICENSE +21 -0
- package/README.md +194 -0
- package/bin/cli.js +2 -0
- package/dist/constants.d.ts +71 -0
- package/dist/constants.js +128 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +229 -0
- package/dist/ink-prompts.d.ts +12 -0
- package/dist/ink-prompts.js +363 -0
- package/dist/prompts.d.ts +16 -0
- package/dist/prompts.js +434 -0
- package/dist/scaffold.d.ts +19 -0
- package/dist/scaffold.js +303 -0
- package/dist/ui.d.ts +27 -0
- package/dist/ui.js +254 -0
- package/package.json +74 -0
- package/templates/app/App.tsx +21 -0
- package/templates/base/CLAUDE.md +332 -0
- package/templates/base/eslint.config.js +28 -0
- package/templates/base/index.html +17 -0
- package/templates/base/package.json +43 -0
- package/templates/base/postcss.config.js +6 -0
- package/templates/base/tailwind.config.js +81 -0
- package/templates/base/tsconfig.json +25 -0
- package/templates/base/vite.config.ts +16 -0
- package/templates/commands/brainstorm.md +6 -0
- package/templates/commands/build.md +41 -0
- package/templates/commands/execute-plan.md +6 -0
- package/templates/commands/lint.md +41 -0
- package/templates/commands/ralph.md +113 -0
- package/templates/commands/typecheck.md +44 -0
- package/templates/commands/write-plan.md +6 -0
- package/templates/components/ErrorBoundary.tsx +49 -0
- package/templates/components/ui/Button.tsx +60 -0
- package/templates/components/ui/CodeBlock.tsx +46 -0
- package/templates/components/ui/CopyCommand.tsx +38 -0
- package/templates/components/ui/FilePreview.tsx +46 -0
- package/templates/components/ui/SkipLink.tsx +7 -0
- package/templates/components/ui/ThemeSelector.tsx +41 -0
- package/templates/components/ui/UICarousel.tsx +309 -0
- package/templates/context/ThemeContext.tsx +61 -0
- package/templates/homepage/HomePage.tsx +534 -0
- package/templates/homepage/NotFoundPage.tsx +17 -0
- package/templates/hooks/README.md +82 -0
- package/templates/hooks/check-branch.js +27 -0
- package/templates/hooks/typecheck-after-edit.js +51 -0
- package/templates/index.css +67 -0
- package/templates/lib/utils.ts +9 -0
- package/templates/main.tsx +16 -0
- package/templates/settings/MCP_SETUP.md +76 -0
- package/templates/settings/settings.json +16 -0
- package/templates/settings/settings.local.json +37 -0
- package/templates/skills/design/a11y-audit/SKILL.md +173 -0
- package/templates/skills/design/design-polish/SKILL.md +75 -0
- package/templates/skills/design/figma-to-code/SKILL.md +157 -0
- package/templates/skills/design/json-ld/SKILL.md +125 -0
- package/templates/skills/design/microcopy/SKILL.md +197 -0
- package/templates/skills/design/og-image/SKILL.md +157 -0
- package/templates/skills/design/ralph-wiggum-loops/SKILL.md +299 -0
- package/templates/skills/design/react-best-practices/SKILL.md +106 -0
- package/templates/skills/design/react-best-practices/references/react-performance-guidelines.md +143 -0
- package/templates/skills/design/seo-review/SKILL.md +96 -0
- package/templates/skills/design/sitemap-generator/SKILL.md +66 -0
- package/templates/skills/design/testing-patterns/SKILL.md +276 -0
- package/templates/skills/design/ui-skills/SKILL.md +85 -0
- package/templates/skills/design/visual-iteration/SKILL.md +88 -0
- package/templates/skills/workflow/brainstorming/SKILL.md +54 -0
- package/templates/skills/workflow/dispatching-parallel-agents/SKILL.md +180 -0
- package/templates/skills/workflow/executing-plans/SKILL.md +76 -0
- package/templates/skills/workflow/finishing-a-development-branch/SKILL.md +200 -0
- package/templates/skills/workflow/receiving-code-review/SKILL.md +213 -0
- package/templates/skills/workflow/requesting-code-review/SKILL.md +105 -0
- package/templates/skills/workflow/requesting-code-review/code-reviewer.md +146 -0
- package/templates/skills/workflow/subagent-driven-development/SKILL.md +240 -0
- package/templates/skills/workflow/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/templates/skills/workflow/subagent-driven-development/implementer-prompt.md +78 -0
- package/templates/skills/workflow/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/templates/skills/workflow/systematic-debugging/CREATION-LOG.md +119 -0
- package/templates/skills/workflow/systematic-debugging/SKILL.md +296 -0
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting.md +115 -0
- package/templates/skills/workflow/systematic-debugging/defense-in-depth.md +122 -0
- package/templates/skills/workflow/systematic-debugging/find-polluter.sh +63 -0
- package/templates/skills/workflow/systematic-debugging/root-cause-tracing.md +169 -0
- package/templates/skills/workflow/systematic-debugging/test-academic.md +14 -0
- package/templates/skills/workflow/systematic-debugging/test-pressure-1.md +58 -0
- package/templates/skills/workflow/systematic-debugging/test-pressure-2.md +68 -0
- package/templates/skills/workflow/systematic-debugging/test-pressure-3.md +69 -0
- package/templates/skills/workflow/test-driven-development/SKILL.md +371 -0
- package/templates/skills/workflow/test-driven-development/testing-anti-patterns.md +299 -0
- package/templates/skills/workflow/using-git-worktrees/SKILL.md +217 -0
- package/templates/skills/workflow/using-superpowers/SKILL.md +87 -0
- package/templates/skills/workflow/verification-before-completion/SKILL.md +139 -0
- package/templates/skills/workflow/writing-plans/SKILL.md +116 -0
- package/templates/skills/workflow/writing-skills/SKILL.md +655 -0
- package/templates/skills/workflow/writing-skills/anthropic-best-practices.md +1150 -0
- package/templates/skills/workflow/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/templates/skills/workflow/writing-skills/graphviz-conventions.dot +172 -0
- package/templates/skills/workflow/writing-skills/persuasion-principles.md +187 -0
- package/templates/skills/workflow/writing-skills/render-graphs.js +168 -0
- package/templates/skills/workflow/writing-skills/testing-skills-with-subagents.md +384 -0
- package/templates/types/index.ts +17 -0
- package/templates/vite-env.d.ts +1 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# JSON-LD Structured Data
|
|
2
|
+
|
|
3
|
+
Generate JSON-LD structured data for SEO and rich search results.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Setting up a new page type
|
|
8
|
+
- Adding product/article/event pages
|
|
9
|
+
- Improving search appearance
|
|
10
|
+
|
|
11
|
+
## Common Schemas
|
|
12
|
+
|
|
13
|
+
### Website (add to homepage)
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script type="application/ld+json">
|
|
17
|
+
{
|
|
18
|
+
"@context": "https://schema.org",
|
|
19
|
+
"@type": "WebSite",
|
|
20
|
+
"name": "Site Name",
|
|
21
|
+
"url": "https://example.com",
|
|
22
|
+
"description": "Site description",
|
|
23
|
+
"potentialAction": {
|
|
24
|
+
"@type": "SearchAction",
|
|
25
|
+
"target": "https://example.com/search?q={search_term_string}",
|
|
26
|
+
"query-input": "required name=search_term_string"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Organization
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<script type="application/ld+json">
|
|
36
|
+
{
|
|
37
|
+
"@context": "https://schema.org",
|
|
38
|
+
"@type": "Organization",
|
|
39
|
+
"name": "Company Name",
|
|
40
|
+
"url": "https://example.com",
|
|
41
|
+
"logo": "https://example.com/logo.png",
|
|
42
|
+
"sameAs": [
|
|
43
|
+
"https://twitter.com/handle",
|
|
44
|
+
"https://github.com/handle"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Article/Blog Post
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<script type="application/ld+json">
|
|
54
|
+
{
|
|
55
|
+
"@context": "https://schema.org",
|
|
56
|
+
"@type": "Article",
|
|
57
|
+
"headline": "Article Title",
|
|
58
|
+
"description": "Article description",
|
|
59
|
+
"image": "https://example.com/image.jpg",
|
|
60
|
+
"datePublished": "2024-01-01",
|
|
61
|
+
"dateModified": "2024-01-02",
|
|
62
|
+
"author": {
|
|
63
|
+
"@type": "Person",
|
|
64
|
+
"name": "Author Name"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Product
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<script type="application/ld+json">
|
|
74
|
+
{
|
|
75
|
+
"@context": "https://schema.org",
|
|
76
|
+
"@type": "Product",
|
|
77
|
+
"name": "Product Name",
|
|
78
|
+
"description": "Product description",
|
|
79
|
+
"image": "https://example.com/product.jpg",
|
|
80
|
+
"offers": {
|
|
81
|
+
"@type": "Offer",
|
|
82
|
+
"price": "99.00",
|
|
83
|
+
"priceCurrency": "USD",
|
|
84
|
+
"availability": "https://schema.org/InStock"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### BreadcrumbList
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<script type="application/ld+json">
|
|
94
|
+
{
|
|
95
|
+
"@context": "https://schema.org",
|
|
96
|
+
"@type": "BreadcrumbList",
|
|
97
|
+
"itemListElement": [
|
|
98
|
+
{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://example.com" },
|
|
99
|
+
{ "@type": "ListItem", "position": 2, "name": "Blog", "item": "https://example.com/blog" },
|
|
100
|
+
{ "@type": "ListItem", "position": 3, "name": "Post Title" }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## React Component Pattern
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
interface JsonLdProps {
|
|
110
|
+
data: Record<string, unknown>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function JsonLd({ data }: JsonLdProps) {
|
|
114
|
+
return (
|
|
115
|
+
<script
|
|
116
|
+
type="application/ld+json"
|
|
117
|
+
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Validation
|
|
124
|
+
|
|
125
|
+
Test at: https://search.google.com/test/rich-results
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Microcopy
|
|
2
|
+
|
|
3
|
+
Write clear, helpful interface text.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
1. **Be concise** — Every word earns its place
|
|
8
|
+
2. **Be specific** — "Save changes" not "Submit"
|
|
9
|
+
3. **Be human** — Write how people talk
|
|
10
|
+
4. **Be helpful** — Guide, don't blame
|
|
11
|
+
|
|
12
|
+
## Patterns
|
|
13
|
+
|
|
14
|
+
### Buttons
|
|
15
|
+
|
|
16
|
+
| Instead of | Write |
|
|
17
|
+
|------------|-------|
|
|
18
|
+
| Submit | Save changes |
|
|
19
|
+
| Click here | View details |
|
|
20
|
+
| OK | Got it |
|
|
21
|
+
| Cancel | Never mind |
|
|
22
|
+
| Delete | Remove |
|
|
23
|
+
| Yes/No | Specific actions |
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
// ✗ Vague
|
|
27
|
+
<button>Submit</button>
|
|
28
|
+
|
|
29
|
+
// ✓ Specific
|
|
30
|
+
<button>Create account</button>
|
|
31
|
+
<button>Save draft</button>
|
|
32
|
+
<button>Send message</button>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Empty States
|
|
36
|
+
|
|
37
|
+
Structure: **What** + **Why** + **Action**
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// ✗ Bad
|
|
41
|
+
<p>No items</p>
|
|
42
|
+
|
|
43
|
+
// ✓ Good
|
|
44
|
+
<div>
|
|
45
|
+
<h3>No projects yet</h3>
|
|
46
|
+
<p>Create your first project to get started.</p>
|
|
47
|
+
<button>Create project</button>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Error Messages
|
|
52
|
+
|
|
53
|
+
Structure: **What happened** + **How to fix**
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// ✗ Bad
|
|
57
|
+
"Error: Invalid input"
|
|
58
|
+
"Something went wrong"
|
|
59
|
+
"Error 500"
|
|
60
|
+
|
|
61
|
+
// ✓ Good
|
|
62
|
+
"Enter a valid email address, like name@example.com"
|
|
63
|
+
"We couldn't save your changes. Check your connection and try again."
|
|
64
|
+
"This page isn't available. It may have been moved or deleted."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Form Labels & Hints
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
// ✗ Bad
|
|
71
|
+
<label>Password</label>
|
|
72
|
+
<input type="password" />
|
|
73
|
+
|
|
74
|
+
// ✓ Good
|
|
75
|
+
<label>Password</label>
|
|
76
|
+
<span className="hint">At least 8 characters</span>
|
|
77
|
+
<input type="password" />
|
|
78
|
+
|
|
79
|
+
// ✓ Better with examples
|
|
80
|
+
<label>Username</label>
|
|
81
|
+
<span className="hint">Letters and numbers only, like alex_123</span>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Confirmations
|
|
85
|
+
|
|
86
|
+
Be specific about what will happen:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
// ✗ Bad
|
|
90
|
+
"Are you sure?"
|
|
91
|
+
|
|
92
|
+
// ✓ Good
|
|
93
|
+
<Dialog>
|
|
94
|
+
<h3>Delete "Project Alpha"?</h3>
|
|
95
|
+
<p>This will permanently delete all files and cannot be undone.</p>
|
|
96
|
+
<button>Cancel</button>
|
|
97
|
+
<button>Delete project</button>
|
|
98
|
+
</Dialog>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Loading States
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
// Simple
|
|
105
|
+
"Loading..."
|
|
106
|
+
|
|
107
|
+
// With context
|
|
108
|
+
"Loading your projects..."
|
|
109
|
+
"Saving changes..."
|
|
110
|
+
"Sending message..."
|
|
111
|
+
|
|
112
|
+
// With progress
|
|
113
|
+
"Uploading... 3 of 12 files"
|
|
114
|
+
"Processing... This may take a minute"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Success Messages
|
|
118
|
+
|
|
119
|
+
Be brief, confirm what happened:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
// ✗ Too much
|
|
123
|
+
"Congratulations! Your account has been successfully created!"
|
|
124
|
+
|
|
125
|
+
// ✓ Just right
|
|
126
|
+
"Account created"
|
|
127
|
+
"Changes saved"
|
|
128
|
+
"Message sent"
|
|
129
|
+
|
|
130
|
+
// ✓ With next step
|
|
131
|
+
"Account created. Check your email to verify."
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Placeholder Text
|
|
135
|
+
|
|
136
|
+
Help users understand the expected format:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// ✗ Bad
|
|
140
|
+
placeholder="Enter text here"
|
|
141
|
+
placeholder="Name"
|
|
142
|
+
|
|
143
|
+
// ✓ Good
|
|
144
|
+
placeholder="Search projects..."
|
|
145
|
+
placeholder="Jane Smith"
|
|
146
|
+
placeholder="https://example.com"
|
|
147
|
+
placeholder="Add a comment..."
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Tooltips & Hints
|
|
151
|
+
|
|
152
|
+
Keep under 10 words if possible:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
// ✗ Too long
|
|
156
|
+
"Click this button to save all your changes to the database"
|
|
157
|
+
|
|
158
|
+
// ✓ Concise
|
|
159
|
+
"Save changes"
|
|
160
|
+
"Copy to clipboard"
|
|
161
|
+
"Opens in new tab"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Voice & Tone
|
|
165
|
+
|
|
166
|
+
### Do
|
|
167
|
+
- Use contractions (you're, we'll, isn't)
|
|
168
|
+
- Use "you" and "your"
|
|
169
|
+
- Use active voice
|
|
170
|
+
- Start with verbs for actions
|
|
171
|
+
|
|
172
|
+
### Don't
|
|
173
|
+
- Use jargon or technical terms
|
|
174
|
+
- Blame the user ("You entered wrong...")
|
|
175
|
+
- Use ALL CAPS (except logos)
|
|
176
|
+
- End button text with punctuation
|
|
177
|
+
|
|
178
|
+
## Common Rewrites
|
|
179
|
+
|
|
180
|
+
| Original | Rewrite |
|
|
181
|
+
|----------|---------|
|
|
182
|
+
| Invalid credentials | Email or password is incorrect |
|
|
183
|
+
| Field required | Enter your email |
|
|
184
|
+
| Max 100 characters | 100 characters max |
|
|
185
|
+
| Operation successful | Done |
|
|
186
|
+
| Click here to learn more | Learn more |
|
|
187
|
+
| Please wait... | Loading... |
|
|
188
|
+
| N/A | — (em dash) or leave empty |
|
|
189
|
+
| TBD | Coming soon |
|
|
190
|
+
|
|
191
|
+
## Checklist
|
|
192
|
+
|
|
193
|
+
- [ ] Can a 12-year-old understand it?
|
|
194
|
+
- [ ] Is every word necessary?
|
|
195
|
+
- [ ] Does it say what will happen?
|
|
196
|
+
- [ ] Is it consistent with other UI text?
|
|
197
|
+
- [ ] Does it help the user succeed?
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# OG Image Generator
|
|
2
|
+
|
|
3
|
+
Create Open Graph images for social sharing.
|
|
4
|
+
|
|
5
|
+
## Specifications
|
|
6
|
+
|
|
7
|
+
| Platform | Size | Aspect Ratio |
|
|
8
|
+
|----------|------|--------------|
|
|
9
|
+
| Open Graph | 1200×630 | 1.91:1 |
|
|
10
|
+
| Twitter | 1200×628 | 1.91:1 |
|
|
11
|
+
| LinkedIn | 1200×627 | 1.91:1 |
|
|
12
|
+
| Facebook | 1200×630 | 1.91:1 |
|
|
13
|
+
|
|
14
|
+
**Safe zone:** Keep text within 1080×560 centered area.
|
|
15
|
+
|
|
16
|
+
## Template Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
┌─────────────────────────────────────────┐
|
|
20
|
+
│ │
|
|
21
|
+
│ LOGO (optional, top-left) │
|
|
22
|
+
│ │
|
|
23
|
+
│ │
|
|
24
|
+
│ HEADLINE │
|
|
25
|
+
│ Large, bold, max 2 lines │
|
|
26
|
+
│ │
|
|
27
|
+
│ Subheadline (optional) │
|
|
28
|
+
│ Smaller, max 1 line │
|
|
29
|
+
│ │
|
|
30
|
+
│ │
|
|
31
|
+
│ DOMAIN (bottom-left) VISUAL (right) │
|
|
32
|
+
│ │
|
|
33
|
+
└─────────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Design Guidelines
|
|
37
|
+
|
|
38
|
+
### Typography
|
|
39
|
+
- Headline: 48-72px, bold
|
|
40
|
+
- Subheadline: 24-32px, regular
|
|
41
|
+
- Domain: 18-24px, medium
|
|
42
|
+
- Max 50 characters per line
|
|
43
|
+
|
|
44
|
+
### Colors
|
|
45
|
+
- High contrast (4.5:1 minimum)
|
|
46
|
+
- Match brand colors
|
|
47
|
+
- Solid backgrounds work best (gradients can compress poorly)
|
|
48
|
+
|
|
49
|
+
### Content
|
|
50
|
+
- One clear message
|
|
51
|
+
- No small text (unreadable in previews)
|
|
52
|
+
- Avoid busy backgrounds
|
|
53
|
+
- Include brand element (logo, color, pattern)
|
|
54
|
+
|
|
55
|
+
## HTML/CSS Template
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<div style="
|
|
59
|
+
width: 1200px;
|
|
60
|
+
height: 630px;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
padding: 60px 80px;
|
|
65
|
+
background: #1a1a2e;
|
|
66
|
+
color: white;
|
|
67
|
+
font-family: system-ui, sans-serif;
|
|
68
|
+
">
|
|
69
|
+
<h1 style="
|
|
70
|
+
font-size: 64px;
|
|
71
|
+
font-weight: 700;
|
|
72
|
+
line-height: 1.1;
|
|
73
|
+
margin: 0 0 20px;
|
|
74
|
+
">
|
|
75
|
+
Your Headline Here
|
|
76
|
+
</h1>
|
|
77
|
+
<p style="
|
|
78
|
+
font-size: 28px;
|
|
79
|
+
opacity: 0.8;
|
|
80
|
+
margin: 0;
|
|
81
|
+
">
|
|
82
|
+
Your subheadline or description
|
|
83
|
+
</p>
|
|
84
|
+
<div style="
|
|
85
|
+
margin-top: auto;
|
|
86
|
+
font-size: 20px;
|
|
87
|
+
opacity: 0.6;
|
|
88
|
+
">
|
|
89
|
+
example.com
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## React Component
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
interface OgImageProps {
|
|
98
|
+
title: string
|
|
99
|
+
subtitle?: string
|
|
100
|
+
domain?: string
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function OgImage({ title, subtitle, domain }: OgImageProps) {
|
|
104
|
+
return (
|
|
105
|
+
<div className="w-[1200px] h-[630px] flex flex-col justify-center p-16 bg-base-300">
|
|
106
|
+
<h1 className="text-6xl font-bold leading-tight mb-4">
|
|
107
|
+
{title}
|
|
108
|
+
</h1>
|
|
109
|
+
{subtitle && (
|
|
110
|
+
<p className="text-2xl text-base-content/70">
|
|
111
|
+
{subtitle}
|
|
112
|
+
</p>
|
|
113
|
+
)}
|
|
114
|
+
{domain && (
|
|
115
|
+
<p className="mt-auto text-xl text-base-content/50">
|
|
116
|
+
{domain}
|
|
117
|
+
</p>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Generation Options
|
|
125
|
+
|
|
126
|
+
### 1. Static (recommended for simple sites)
|
|
127
|
+
- Create in Figma/design tool
|
|
128
|
+
- Export as PNG
|
|
129
|
+
- Place in `public/og-image.png`
|
|
130
|
+
|
|
131
|
+
### 2. Dynamic (for blogs/products)
|
|
132
|
+
- Use @vercel/og or Satori
|
|
133
|
+
- Generate at build time or on-demand
|
|
134
|
+
- Create API route: `/api/og?title=...`
|
|
135
|
+
|
|
136
|
+
### 3. Screenshot service
|
|
137
|
+
- Use Puppeteer/Playwright
|
|
138
|
+
- Render HTML template
|
|
139
|
+
- Screenshot at 1200×630
|
|
140
|
+
|
|
141
|
+
## Meta Tags
|
|
142
|
+
|
|
143
|
+
```html
|
|
144
|
+
<meta property="og:image" content="https://example.com/og-image.png" />
|
|
145
|
+
<meta property="og:image:width" content="1200" />
|
|
146
|
+
<meta property="og:image:height" content="630" />
|
|
147
|
+
<meta property="og:image:alt" content="Description of image" />
|
|
148
|
+
<meta name="twitter:image" content="https://example.com/og-image.png" />
|
|
149
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Testing
|
|
153
|
+
|
|
154
|
+
- Facebook: https://developers.facebook.com/tools/debug/
|
|
155
|
+
- Twitter: https://cards-dev.twitter.com/validator
|
|
156
|
+
- LinkedIn: https://www.linkedin.com/post-inspector/
|
|
157
|
+
- General: https://www.opengraph.xyz/
|