From 71e667bff379a1b1273ec2bf8cb695439f72f4f5 Mon Sep 17 00:00:00 2001 From: scosman Date: Thu, 14 Mar 2024 16:27:01 -0400 Subject: [PATCH] Move config into code. People were getting tripped up on ENV var, and we content in code all over. No need for a second content in env concept. Resolves https://github.com/CriticalMoments/CMSaasStarter/issues/44 --- .github/workflows/format.yml | 1 - .github/workflows/linting.yml | 1 - .github/workflows/tests.yml | 1 - README.md | 6 +++--- local_env_template | 1 - src/config.ts | 1 + src/routes/(marketing)/+page.svelte | 8 ++++---- src/routes/(marketing)/blog/(posts)/+layout.svelte | 4 ++-- src/routes/(marketing)/pricing/+page.svelte | 4 ++-- 9 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 src/config.ts diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 148d5344..2e4c45f9 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -7,7 +7,6 @@ env: PUBLIC_SUPABASE_ANON_KEY: 'fake_anon_key' PRIVATE_SUPABASE_SERVICE_ROLE: 'fake_service_role' PRIVATE_STRIPE_API_KEY: 'fake_strip_api_key' - PUBLIC_SITE_NAME: 'SaaS Starter Build Test' jobs: build_and_test: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7da72c68..3b73fb50 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -7,7 +7,6 @@ env: PUBLIC_SUPABASE_ANON_KEY: 'fake_anon_key' PRIVATE_SUPABASE_SERVICE_ROLE: 'fake_service_role' PRIVATE_STRIPE_API_KEY: 'fake_strip_api_key' - PUBLIC_SITE_NAME: 'SaaS Starter Build Test' jobs: build_and_test: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index adc31b8b..5005e6a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,6 @@ env: PUBLIC_SUPABASE_ANON_KEY: 'fake_anon_key' PRIVATE_SUPABASE_SERVICE_ROLE: 'fake_service_role' PRIVATE_STRIPE_API_KEY: 'fake_strip_api_key' - PUBLIC_SITE_NAME: 'SaaS Starter Build Test' jobs: build_and_test: diff --git a/README.md b/README.md index 019137ef..32c73fed 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ Finally: if you find build, formatting or linting rules too tedious, you can dis Cloudflare Pages and Workers is one of the most popular options for deploying SvelteKit and we recommend it. [Follow Cloudflare’s instructions](https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site/#deploy-with-cloudflare-pages) to deploy in a few clicks. Be sure to select “SvelteKit” as framework, and the rest of the defaults will work. When prompted: add environment variables for your production environment (PUBLIC_SUPABASE_URL, -PUBLIC_SUPABASE_ANON_KEY, PRIVATE_SUPABASE_SERVICE_ROLE, PRIVATE_STRIPE_API_KEY, and PUBLIC_SITE_NAME). +PUBLIC_SUPABASE_ANON_KEY, PRIVATE_SUPABASE_SERVICE_ROLE, and PRIVATE_STRIPE_API_KEY). Optional: enable [Cloudflare Analytics](https://www.cloudflare.com/en-ca/application-services/products/analytics/) for usage metrics. @@ -232,7 +232,7 @@ If you prefer another host you can explore alternatives: After the steps above, you’ll have a working version like the demo page. However, it’s not branded, and doesn’t have your content. The following checklist helps you customize the template to make a SaaS homepage for your company. -- Set the PUBLIC_SITE_NAME to your company name in `.env.local` and your production environment. +- Set a name for your site in `src/config.ts:WebsiteName` - Content - Add actual content for marketing homepage - Add actual content for your blog (or delete the blog) @@ -241,7 +241,7 @@ After the steps above, you’ll have a working version like the demo page. Howev - Add any pages you want on top of our boiler plate (about, terms of service, etc). Be sure to add links to them in the header, mobile menu header, and footer as appropriate (`src/routes/(marketing)/+layout.svelte`). - Note: if you add any dynamic content to the main marketing page, pricing page or blog, be sure to set `prerender = false` in the appropriate `+page.ts` file. These are currently pre-rendered and served as static assets for performance reasons, but that will break if you add server side rendering requirements. - Update SEO content - - Update title and meta description tags for every public page. We include generic ones using your site name (PUBLIC_SITE_NAME), but the more specific these are the better. + - Update title and meta description tags for every public page. We include generic ones using your site name (`src/config.ts:WebsiteName`), but the more specific these are the better. - This done automatically for blog posts from `posts.ts` metadata - Style - Create a new DaisyUI Theme matching your brand or use one of the built in themes from DaisyUI (see `tailwind.config.js`) diff --git a/local_env_template b/local_env_template index a6593562..fadeee14 100644 --- a/local_env_template +++ b/local_env_template @@ -2,4 +2,3 @@ PUBLIC_SUPABASE_URL='https://REPLACE_ME.supabase.co' PUBLIC_SUPABASE_ANON_KEY='REPLACE_ME' PRIVATE_SUPABASE_SERVICE_ROLE='REPLACE_ME' PRIVATE_STRIPE_API_KEY='REPLACE_ME' -PUBLIC_SITE_NAME='REPLACE_ME' diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 00000000..e104ffba --- /dev/null +++ b/src/config.ts @@ -0,0 +1 @@ +export const WebsiteName: string = "SaaS Starter" diff --git a/src/routes/(marketing)/+page.svelte b/src/routes/(marketing)/+page.svelte index 63ebb07f..5ebfae9b 100644 --- a/src/routes/(marketing)/+page.svelte +++ b/src/routes/(marketing)/+page.svelte @@ -1,4 +1,6 @@ - {PUBLIC_SITE_NAME} - + {WebsiteName} +
diff --git a/src/routes/(marketing)/blog/(posts)/+layout.svelte b/src/routes/(marketing)/blog/(posts)/+layout.svelte index a35b9d1a..690962df 100644 --- a/src/routes/(marketing)/blog/(posts)/+layout.svelte +++ b/src/routes/(marketing)/blog/(posts)/+layout.svelte @@ -2,7 +2,7 @@ import { page } from "$app/stores" import { error } from "@sveltejs/kit" import { sortedBlogPosts, type BlogPost } from "./../posts" - import { PUBLIC_SITE_NAME } from "$env/static/public" + import { WebsiteName } from "../../../../config" let currentPost: BlogPost | null = null for (const post of sortedBlogPosts) { @@ -32,7 +32,7 @@ - + diff --git a/src/routes/(marketing)/pricing/+page.svelte b/src/routes/(marketing)/pricing/+page.svelte index 2e13a5da..792c1d01 100644 --- a/src/routes/(marketing)/pricing/+page.svelte +++ b/src/routes/(marketing)/pricing/+page.svelte @@ -1,11 +1,11 @@ Pricing - +