Spaces:
Configuration error
Configuration error
fix: SEO lib uses dynamic OG route as default image (fixes missing og-image.png)
Browse files- src/lib/seo.ts +4 -4
src/lib/seo.ts
CHANGED
|
@@ -12,7 +12,9 @@ export interface SEOConfig {
|
|
| 12 |
}
|
| 13 |
|
| 14 |
const BASE_URL = process.env.NEXT_PUBLIC_APP_URL || 'https://open-prompt.netlify.app'
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Generate a dynamic OG image URL via /api/og
|
|
@@ -200,8 +202,6 @@ export function generatePromptSchema(prompt: {
|
|
| 200 |
remixesCount?: number
|
| 201 |
category?: string
|
| 202 |
}) {
|
| 203 |
-
// Only emit AggregateRating when there are ≥5 meaningful data points
|
| 204 |
-
// and use a proper 1-5 scale (not the bugged 3+ formula)
|
| 205 |
const hasEnoughRatings = prompt.starsCount >= 5
|
| 206 |
const normalizedRating = hasEnoughRatings
|
| 207 |
? Math.min(5, Math.max(1, 1 + (prompt.starsCount / (prompt.starsCount + 10)) * 4))
|
|
@@ -252,7 +252,7 @@ export function generateToolSchema(tool: {
|
|
| 252 |
'@type': 'WebApplication',
|
| 253 |
name: tool.name,
|
| 254 |
description: tool.description,
|
| 255 |
-
url: `${BASE_URL}/tools/${tool.
|
| 256 |
applicationCategory: 'Productivity',
|
| 257 |
operatingSystem: 'Web',
|
| 258 |
offers: {
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
const BASE_URL = process.env.NEXT_PUBLIC_APP_URL || 'https://open-prompt.netlify.app'
|
| 15 |
+
|
| 16 |
+
// Use dynamic OG route as default (no static og-image.png needed)
|
| 17 |
+
const DEFAULT_IMAGE = `${BASE_URL}/api/og?title=OpenPrompt&description=The+GitHub+for+AI+Prompts`
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Generate a dynamic OG image URL via /api/og
|
|
|
|
| 202 |
remixesCount?: number
|
| 203 |
category?: string
|
| 204 |
}) {
|
|
|
|
|
|
|
| 205 |
const hasEnoughRatings = prompt.starsCount >= 5
|
| 206 |
const normalizedRating = hasEnoughRatings
|
| 207 |
? Math.min(5, Math.max(1, 1 + (prompt.starsCount / (prompt.starsCount + 10)) * 4))
|
|
|
|
| 252 |
'@type': 'WebApplication',
|
| 253 |
name: tool.name,
|
| 254 |
description: tool.description,
|
| 255 |
+
url: `${BASE_URL}/tools/${tool.slug}`,
|
| 256 |
applicationCategory: 'Productivity',
|
| 257 |
operatingSystem: 'Web',
|
| 258 |
offers: {
|