-
Notifications
You must be signed in to change notification settings - Fork 0
chore: schema on review #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,7 @@ function updateData() { | |||||
| } | ||||||
|
|
||||||
| const { items } = useBreadcrumb() | ||||||
| const { app } = useAppConfig() | ||||||
|
|
||||||
| const submenuItems = computed<NavigationMenuItem[]>(() => [ | ||||||
| { | ||||||
|
|
@@ -78,4 +79,18 @@ const submenuItems = computed<NavigationMenuItem[]>(() => [ | |||||
| badge: page.value?.points?.length ? page.value.points.length : undefined, // show if more than 0 | ||||||
| }, | ||||||
| ]) | ||||||
|
|
||||||
| useSchemaOrg([ | ||||||
| defineLocalBusiness({ | ||||||
| url: `${app.url}/${params.pageSlug}`, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find the file and examine its context
fd '[pageSlug].vue' --type f | head -5Repository: k39space/k39 Length of output: 284 🏁 Script executed: # List files in apps/web-app/app/pages directory
fd '.' apps/web-app/app/pages --type f -name '*.vue' | grep -i slugRepository: k39space/k39 Length of output: 286 🏁 Script executed: # Find the [pageSlug].vue file
find . -name '*pageSlug*' -type f 2>/dev/nullRepository: k39space/k39 Length of output: 146 🏁 Script executed: # Also search in the pages directory for any dynamic page files
find apps/web-app/app/pages -name '*.vue' -type f 2>/dev/null | head -20Repository: k39space/k39 Length of output: 729 🏁 Script executed: # Search for slug-related patterns in the codebase
rg 'pageSlug|encodeURIComponent.*slug|slug.*encode' --type vue -C 3 | head -50Repository: k39space/k39 Length of output: 83 🏁 Script executed: # Search for encodeURIComponent in Vue files
rg 'encodeURIComponent|pageSlug' apps/web-app/app --type-add 'vue:*.vue' -g '*.vue' -C 3Repository: k39space/k39 Length of output: 9454 🏁 Script executed: # Read the specific file mentioned in the review
cat -n apps/web-app/app/pages/[pageSlug].vue | head -100Repository: k39space/k39 Length of output: 3201 🏁 Script executed: # Search for slug validation, sanitization, or constraints
rg 'slug.*valid|slug.*sanitize|slug.*pattern|const.*slug.*=|type.*slug' apps/web-app --type ts -C 2 | head -80Repository: k39space/k39 Length of output: 860 🏁 Script executed: # Check if there's an API endpoint that creates/validates slugs
find apps -name '*.ts' -type f -exec grep -l 'slug' {} \; | head -10Repository: k39space/k39 Length of output: 155 🏁 Script executed: # Look for slug patterns or regex constraints
rg 'pageSlug|slug' apps/server --type ts -B 1 -A 1 | head -60Repository: k39space/k39 Length of output: 107 🏁 Script executed: # Check the API endpoint implementation
cat -n apps/web-app/server/api/page/slug/[slug].get.tsRepository: k39space/k39 Length of output: 760 🏁 Script executed: # Search for any slug encoding/decoding in the codebase
rg 'decodeURI|encodeURI|URLDecode|URLEncode' apps/web-app --type ts -C 2Repository: k39space/k39 Length of output: 349 🏁 Script executed: # Check how database models define slugs (constraints, type, etc.)
find . -name '*.prisma' -o -name 'schema.*' | head -5Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Check how pages are created/edited - look for slug validation
rg 'slug.*String|slug.*required|slug.*pattern|slug.*validate' apps/database --type prisma --type ts -C 2Repository: k39space/k39 Length of output: 86 🏁 Script executed: # Check the database schema for page slug constraints
find . -path '*/database/*' -name '*.prisma' -exec cat {} \; | grep -A 5 -B 5 'slug'Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Find prisma schema without type specification
find . -name '*.prisma' 2>/dev/nullRepository: k39space/k39 Length of output: 38 🏁 Script executed: # Look for where the slug value comes from in Nuxt
rg 'params\.pageSlug' apps/web-app/app/pages/\[pageSlug\].vue -C 5Repository: k39space/k39 Length of output: 1215 🏁 Script executed: # Check if pageSlug is decoded anywhere (Nuxt auto-decodes route params)
rg 'useRoute|getRouterParam' apps/web-app --type ts -A 2 | grep -A 2 'slug' | head -30Repository: k39space/k39 Length of output: 777 🏁 Script executed: # Check if there's slug validation during page creation
rg 'slug.*[a-z0-9-]|slug.*regex|slug.*pattern' . --type ts | head -20Repository: k39space/k39 Length of output: 826 🏁 Script executed: # Look at how Nuxt handles route params - check if there's any decode happening
rg 'decodeURIComponent|useRoute' apps/web-app/app/pages/\[pageSlug\].vueRepository: k39space/k39 Length of output: 100 🏁 Script executed: # Check if the slug is used in other URL contexts (to understand encoding needs)
rg 'pageSlug.*http|url.*pageSlug|href.*pageSlug' apps/web-app --type vue -B 2 -A 2Repository: k39space/k39 Length of output: 83 🏁 Script executed: # Check if there's any slug validation or constraints during page creation
rg 'slug.*create|slug.*update|POST.*page|PUT.*page' packages/database -A 3 -B 1 | head -40Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Look for where slugs are created/validated (might show character constraints)
find packages -name '*.ts' -exec grep -l 'slug' {} \; | xargs grep -l 'create\|update\|validation'Repository: k39space/k39 Length of output: 128 🏁 Script executed: # Check navigation links to see if encodeURIComponent is used there
rg 'to:.*pageSlug|navigateTo.*pageSlug' apps/web-app/app --type vueRepository: k39space/k39 Length of output: 83 🏁 Script executed: # Check the page repository to see if there's slug validation/sanitization during creation
cat packages/database/src/repository/page.ts | head -80Repository: k39space/k39 Length of output: 2096 🏁 Script executed: # Check for any slug validation or transformation in services
rg 'slug.*toLowerCase|slug.*replace|slug.*transform|slug.*sanitize' packages -C 2Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Check if slugs are restricted to safe characters during creation
find packages -name '*.ts' -type f -exec grep -l 'Page\|page.*create\|page.*new' {} \; | head -5Repository: k39space/k39 Length of output: 385 🏁 Script executed: # Check the full page table definition for any constraints
cat packages/database/src/tables.ts | grep -A 10 -B 5 'slug.*varchar'Repository: k39space/k39 Length of output: 1464 🏁 Script executed: # Look for any form validation or slug sanitization before API calls
rg 'slug.*value|slug.*input|slug.*form' packages --type ts -B 2 -A 2 | head -40Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Check if Nuxt automatically encodes params when used in router-link 'to'
rg 'defineLocalBusiness|useSchemaOrg' apps/web-app/app -B 3 -A 3 | head -40Repository: k39space/k39 Length of output: 1392 🏁 Script executed: # Look for any slug character restrictions or validation in frontend forms
rg 'slug.*pattern|slug.*maxlength|slug.*validation|slug.*[a-z0-9]' apps/web-app/app --type ts -C 2 | head -30Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Check if useFetch automatically encodes URL parameters
rg 'useFetch.*params|useFetch.*slug' apps/web-app/app --type ts -B 2 -A 2 | head -30Repository: k39space/k39 Length of output: 38 🏁 Script executed: # Check if there's any slug sanitization or normalization during page creation in frontend
find apps/web-app/app -name '*.ts' -o -name '*.vue' | xargs grep -l 'slug.*sanitize\|slug.*normalize\|slug.*toLowerCase' 2>/dev/nullRepository: k39space/k39 Length of output: 40 🏁 Script executed: # Final check: does the schema.org library handle URL encoding?
rg 'useSchemaOrg|defineLocalBusiness' -A 5 -B 5 apps/web-app/app | head -40Repository: k39space/k39 Length of output: 2383 🏁 Script executed: # Check if there's any slug pattern validation or restriction during page creation
rg 'slug.*[a-zA-Z0-9]|slug.*pattern|slug.*regex|slug.*match' packages/database -C 2Repository: k39space/k39 Length of output: 2585 🏁 Script executed: # Look at how Nuxt extracts route params - check if they're decoded
rg 'getRouterParam|useRoute' apps/web-app/server -B 2 -A 2 | head -20Repository: k39space/k39 Length of output: 1497 🏁 Script executed: # Check if Nuxt's useRoute automatically decodes params
rg 'decodeURI|decode' apps/web-app/app/pages/\[pageSlug\].vueRepository: k39space/k39 Length of output: 38 🏁 Script executed: # Verify: are slugs restricted to URL-safe characters in page creation?
find apps/web-app -name '*.ts' -o -name '*.vue' | xargs grep -l 'page.*create\|page.*POST' 2>/dev/null | head -3Repository: k39space/k39 Length of output: 237 URL-encode the pageSlug for structured data validity. Route parameters are automatically URL-decoded by Nuxt, and when reconstructing URLs manually, encoding must be handled explicitly. Use - url: `${app.url}/${params.pageSlug}`,
+ url: `${app.url}/${encodeURIComponent(params.pageSlug)}`,This ensures the JSON-LD URL is properly formatted even if the slug contains special characters. Skip this only if slug creation is strictly validated to ASCII-safe characters. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| name: page.value?.title, | ||||||
| }), | ||||||
| defineAggregateRating({ | ||||||
| '@type': 'AggregateRating', | ||||||
| 'ratingValue': page.value?.rating, | ||||||
| 'ratingCount': page.value?.reviewsCount, | ||||||
| 'bestRating': 5, | ||||||
| 'worstRating': 1, | ||||||
| }), | ||||||
|
Comment on lines
+88
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conditionally emit AggregateRating only when rating data exists. The Apply this diff to conditionally include the AggregateRating: useSchemaOrg([
defineLocalBusiness({
url: `${app.url}/${params.pageSlug}`,
name: page.value?.title,
}),
- defineAggregateRating({
- '@type': 'AggregateRating',
- 'ratingValue': page.value?.rating,
- 'ratingCount': page.value?.reviewsCount,
- 'bestRating': 5,
- 'worstRating': 1,
- }),
+ ...(page.value?.rating && page.value?.reviewsCount ? [
+ defineAggregateRating({
+ '@type': 'AggregateRating',
+ 'ratingValue': page.value.rating,
+ 'ratingCount': page.value.reviewsCount,
+ 'bestRating': 5,
+ 'worstRating': 1,
+ }),
+ ] : []),
])🤖 Prompt for AI Agents |
||||||
| ]) | ||||||
| </script> | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: k39space/k39
Length of output: 88
🏁 Script executed:
Repository: k39space/k39
Length of output: 4440
🏁 Script executed:
Repository: k39space/k39
Length of output: 1266
🏁 Script executed:
Repository: k39space/k39
Length of output: 5745
🏁 Script executed:
Repository: k39space/k39
Length of output: 1275
Correct the hardcoded site URL to use environment-aware configuration.
The production URL is hardcoded in
nuxt.config.tsunder thesiteconfiguration (line 11), which is used by@nuxtjs/seoto generate sitemaps, canonical URLs, and schema.org metadata. This means all environments will emithttps://k39.onlinein metadata, potentially causing SEO issues during development and staging.Additionally, the unused
urlproperty inapp/app.config.ts(line 3) should be removed or migrated if it serves a purpose.Use Nuxt's environment-specific configuration overrides in
nuxt.config.ts:For
app.config.ts: Remove the unusedurlproperty unless it's being used elsewhere. If needed for future use, migrate it toruntimeConfiginnuxt.config.tsinstead.🤖 Prompt for AI Agents