Skip to content

Commit

Permalink
Update .gitignore and env.server.ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorTom327 committed Jan 7, 2024
1 parent 474ca02 commit d4066b5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_modules
/public/build
.env

.DS_Store

coverage
.vercel
.react-email
6 changes: 5 additions & 1 deletion app/lib/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import zod from "zod";
export const publicEnvSchema = zod.object({
NODE_ENV: zod.enum(["development", "production", "test"]),
APP_NAME: zod.string().default("Valentin Thomas"),
APP_URL: zod.string().default("https://valentin-thomas.com"),
APP_URL: zod.string().default("https://www.valentin-thomas.com"),
VERCEL_ANALYTICS_ID: zod.string().optional(),
VERCEL_URL: zod
.string()
.optional()
.default("https://www.valentin-thomas.com"),
});

export const envSchema = zod
Expand Down
6 changes: 4 additions & 2 deletions app/routes/sitemap[.xml]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { flatten } from "ramda";
import { xml } from "remix-utils/responses";
import projects from "~/data/projects";

import { isDevelopment } from "~/lib/env.server";
import { getEnv, isDevelopment } from "~/lib/env.server";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const routes = flatten([
Expand All @@ -19,12 +19,14 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {

const dateContent = isDevelopment() ? new Date().toISOString() : BUILD_DATE;

const host = getEnv("VERCEL_URL");

const xmlContent = [
`<?xml version="1.0" encoding="UTF-8"?>`,
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`,
...routes.map(
(route) =>
`<url><loc>https://valentin-thomas.com${route}</loc><lastmod>${dateContent}</lastmod></url>`
`<url><loc>https://${host}${route}</loc><lastmod>${dateContent}</lastmod></url>`
),
`</urlset>`,
];
Expand Down

1 comment on commit d4066b5

@vercel
Copy link

@vercel vercel bot commented on d4066b5 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.