From 7e07ad4501b42071a1e816c3a18c8ed6226ae89e Mon Sep 17 00:00:00 2001 From: Guido X Jansen Date: Tue, 26 Nov 2024 22:57:42 +0100 Subject: [PATCH 1/3] ks collection fix --- keystatic.config.ts | 139 +++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 72 deletions(-) diff --git a/keystatic.config.ts b/keystatic.config.ts index 32d8883..07b216c 100644 --- a/keystatic.config.ts +++ b/keystatic.config.ts @@ -17,118 +17,113 @@ export default config({ freelancers: collection({ label: 'Freelancers', path: 'src/content/freelancers/*', - slugField: 'slug', + slugField: 'firstName', + format: 'yaml', schema: { - firstName: fields.text({ + firstName: fields.text({ label: "First Name", validation: { length: { min: 1 } } }), - lastName: fields.text({ + lastName: fields.text({ label: "Last Name", validation: { length: { min: 1 } } }), - slug: fields.text({ - label: "Slug", - validation: { length: { min: 1 } } - }), - photo: fields.image({ + photo: fields.text({ label: "Photo", - directory: "src/images/freelancers", - publicPath: "/src/images/freelancers", - validation: { isRequired: true } + validation: { length: { min: 1 } } }), - headline: fields.text({ - label: "Headline", + headline: fields.text({ + label: "Headline" }), - availability: fields.text({ + availability: fields.text({ label: "Availability", - validation: { isRequired: true } + validation: { length: { min: 1 } } }), - location: fields.text({ + location: fields.text({ label: "Location", - validation: { isRequired: true, length: { min: 1 } } + validation: { length: { min: 1 } } }), - countryCode: fields.text({ + countryCode: fields.text({ label: "Country Code", validation: { length: { min: 2, max: 2 } } }), - language: fields.text({ + language: fields.text({ label: "Languages", - validation: { isRequired: true } + validation: { length: { min: 1 } } }), - shortPitch: fields.text({ + shortPitch: fields.text({ label: "Short Pitch", - multiline: true, - }), - linkedIn: fields.url({ - label: "LinkedIn URL", + multiline: true }), - github: fields.url({ - label: "GitHub URL", + linkedIn: fields.url({ + label: "LinkedIn URL" }), - certifications: fields.multiselect({ - label: "Certifications", - options: [ - { label: "Backend Developer Certified", value: "Backend Developer" }, - { label: "Solution Architect Certified", value: "Solution Architect" } - ], + github: fields.url({ + label: "GitHub URL" }), - sprykerCertifications: fields.text({ + sprykerCertifications: fields.text({ label: "Spryker Certifications", - multiline: true, - }), - skills: fields.multiselect({ - label: "Skills", - options: [ - { label: "Frontend", value: "Frontend" }, - { label: "Back End", value: "Back End" }, - { label: "Architecture", value: "Architecture" }, - { label: "Project Management", value: "Project Management" }, - { label: "Fullstack", value: "Fullstack" }, - { label: "Team Lead", value: "Team Lead" }, - { label: "Tech Lead", value: "Tech Lead" } - ] - }), - timezoneRange: fields.text({ - label: "Timezone Range", - }), - yearStartedWebDev: fields.integer({ + multiline: true + }), + skills: fields.array( + fields.select({ + label: "Skill", + options: [ + { label: "Frontend", value: "Frontend" }, + { label: "Back End", value: "Back End" }, + { label: "Architecture", value: "Architecture" }, + { label: "Project Management", value: "Project Management" }, + { label: "Fullstack", value: "Fullstack" }, + { label: "Team Lead", value: "Team Lead" }, + { label: "Tech Lead", value: "Tech Lead" } + ], + defaultValue: "Back End" + }), + { + label: "Skills", + itemLabel: props => props.value + } + ), + timezoneRange: fields.text({ + label: "Timezone Range" + }), + yearStartedWebDev: fields.integer({ label: "Year Started Web Development", validation: { min: 1980, max: 2050 } }), - yearStartedSpryker: fields.integer({ + yearStartedSpryker: fields.integer({ label: "Year Started with Spryker", validation: { min: 1980, max: 2050 } }), - references: fields.text({ + references: fields.text({ label: "References", - multiline: true, + multiline: true }), - idealCustomer: fields.text({ + idealCustomer: fields.text({ label: "Ideal Customer", - multiline: true, + multiline: true }), - locationFlexibility: fields.text({ - label: "Location Flexibility", + locationFlexibility: fields.text({ + label: "Location Flexibility" }), - otherCertifications: fields.text({ - label: "Other Certifications", + otherCertifications: fields.text({ + label: "Other Certifications" }), - employmentType: fields.text({ - label: "Employment Type", + employmentType: fields.text({ + label: "Employment Type" }), - contact: fields.text({ + contact: fields.text({ label: "Contact Email", validation: { length: { min: 1 } } }), - forumProfile: fields.url({ - label: "Forum Profile URL", + forumProfile: fields.url({ + label: "Forum Profile URL" }), - isVisible: fields.checkbox({ + isVisible: fields.checkbox({ label: "Is Visible", - defaultValue: true, - }), - }, - }), - }, + defaultValue: true + }) + } + }) + } }); From 5a84a18d09bbf142039633b0cc7dc9326f338a71 Mon Sep 17 00:00:00 2001 From: Guido X Jansen Date: Tue, 26 Nov 2024 23:11:20 +0100 Subject: [PATCH 2/3] redirect update --- astro.config.mjs | 9 +++++---- netlify.toml | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 039edca..53d6d69 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -13,7 +13,7 @@ import keystatic from '@keystatic/astro' // https://astro.build/config export default defineConfig({ - site: "https://commercequest.space", // Removed trailing slash + site: "https://commercequest.space", image: { service: { entrypoint: 'astro/assets/services/sharp' @@ -103,14 +103,15 @@ export default defineConfig({ react(), markdoc(), mdx(), - keystatic() // Make sure this is after react() + keystatic() ], - output: "hybrid", // Changed from server to hybrid to match reference project + output: "hybrid", experimental: { clientPrerender: true, directRenderScript: true }, adapter: netlify({ - functionPerRoute: true // Enable function per route for better API handling + functionPerRoute: true, + edgeMiddleware: true // Enable edge middleware for better API routing }) }); diff --git a/netlify.toml b/netlify.toml index 3b24831..429cdc8 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,6 +2,11 @@ command = "npm run build" publish = "dist" +[[redirects]] + from = "/api/keystatic/*" + to = "/.netlify/functions/entry" + status = 200 + [[redirects]] from = "/keystatic" to = "/.netlify/functions/entry" @@ -16,6 +21,7 @@ from = "/*" to = "/index.html" status = 200 + force = false [functions] directory = ".netlify/functions/" From fe6c1992c4edac196d5e4903e698a285227421bb Mon Sep 17 00:00:00 2001 From: Guido X Jansen Date: Wed, 27 Nov 2024 00:17:05 +0100 Subject: [PATCH 3/3] edgeMiddleware fix --- astro.config.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 53d6d69..8635543 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -111,7 +111,11 @@ export default defineConfig({ directRenderScript: true }, adapter: netlify({ - functionPerRoute: true, - edgeMiddleware: true // Enable edge middleware for better API routing - }) + functionPerRoute: true + }), + vite: { + ssr: { + noExternal: ['@keystatic/core'] + } + } });