1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-11-23 11:26:09 -05:00

refactor constants

This commit is contained in:
2025-04-11 14:50:15 -04:00
parent 0ade75716e
commit 37fa6101f6
11 changed files with 54 additions and 37 deletions

View File

@@ -1,13 +1,30 @@
// path to directory with .mdx files, relative to project root
/**
* Locale code to define the site's language in ISO-639 format. Defaults to `en-US`.
* @see https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes#Table
*/
export const SITE_LOCALE = "en-US";
/**
* Consistent timezone for the site. Doesn't really matter what it is, as long as it's the same everywhere to avoid
* hydration complaints.
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
*/
export const SITE_TZ = "America/New_York";
/** Path to directory with .mdx files, relative to project root. */
export const POSTS_DIR = "notes";
// path to an image used in various places to represent the site, relative to project root
// IMPORTANT: must be included in next.config.ts under "outputFileTracingIncludes"
/**
* Path to an image used in various places to represent the site, relative to project root. This path must be included
* in [next.config.ts](../../next.config.ts) under `outputFileTracingIncludes`.
*/
export const AVATAR_PATH = "app/avatar.jpg";
// maximum width of content wrapper (e.g. for images) in pixels
/** Maximum width of content wrapper (e.g. for images) in pixels. */
export const MAX_WIDTH = 865;
// defined in next.config.ts
/** Chooses the most appropriate URL for the current deployment. Defined in [`next.config.ts`](../../next.config.ts). */
export const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL!;
/** Freezes time at build. Defined in [`next.config.ts`](../../next.config.ts). */
export const RELEASE_TIMESTAMP = process.env.NEXT_PUBLIC_RELEASE_TIMESTAMP!;

View File

@@ -1,9 +1,7 @@
// Site info
export const siteName = "Jake Jarvis";
export const siteLocale = "en-US";
export const timeZone = "America/New_York"; // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
export const shortDescription = "Frontend Web Developer in Boston, MA";
export const longDescription =
export const tagline = "Frontend Web Developer in Boston, MA";
export const description =
"Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in TypeScript, React, Next.js, and other JavaScript frameworks.";
export const license = "Creative Commons Attribution 4.0 International";
export const licenseAbbr = "CC-BY-4.0";

View File

@@ -11,15 +11,15 @@ export const env = createEnv({
],
server: {
/**
* Required. GitHub API token used for /projects grid. Only needs the `public_repo` scope since we don't need/want
* to change anything, obviously.
* Required. GitHub API token used for [/projects](../app/projects/page.tsx) grid. Only needs the `public_repo`
* scope since we don't need/want to change anything, obviously.
*
* @see https://github.com/settings/tokens/new?scopes=public_repo
*/
GITHUB_TOKEN: v.optional(v.pipe(v.string(), v.startsWith("ghp_"))),
/**
* Required. Redis storage credentials for hit counter's server component (app/notes/[slug]/counter.tsx) and API
* Required. Redis storage credentials for hit counter's [server component](../app/notes/[slug]/counter.tsx) and API
* endpoint. Currently set automatically by Vercel's Upstash integration.
*
* @see https://upstash.com/docs/redis/sdks/ts/getstarted
@@ -27,7 +27,7 @@ export const env = createEnv({
*/
KV_REST_API_TOKEN: v.string(),
/**
* Required. Redis storage credentials for hit counter's server component (app/notes/[slug]/counter.tsx) and API
* Required. Redis storage credentials for hit counter's [server component](../app/notes/[slug]/counter.tsx) and API
* endpoint. Currently set automatically by Vercel's Upstash integration.
*
* @see https://upstash.com/docs/redis/sdks/ts/getstarted
@@ -36,7 +36,7 @@ export const env = createEnv({
KV_REST_API_URL: v.pipe(v.string(), v.url(), v.startsWith("https://"), v.endsWith(".upstash.io")),
/**
* Required. Uses Resend API to send contact form submissions via a server action (see app/contact/actions.ts). May
* Required. Uses Resend API to send contact form submissions via a [server action](../app/contact/action.ts). May
* be set automatically by Vercel's Resend integration.
*
* @see https://resend.com/api-keys

View File

@@ -15,7 +15,7 @@ export const buildFeed = async (): Promise<Feed> => {
id: `${BASE_URL}`,
link: `${BASE_URL}`,
title: config.siteName,
description: config.longDescription,
description: config.description,
copyright: config.licenseUrl,
updated: new Date(RELEASE_TIMESTAMP),
image: `${BASE_URL}${ogImage.src}`,

View File

@@ -1,22 +1,22 @@
import * as config from "../config";
import { BASE_URL } from "../config/constants";
import { BASE_URL, SITE_LOCALE } from "../config/constants";
import type { Metadata } from "next";
export const defaultMetadata: Metadata = {
metadataBase: new URL(BASE_URL),
title: {
template: `%s ${config.siteName}`,
default: `${config.siteName} ${config.shortDescription}`,
default: `${config.siteName} ${config.tagline}`,
},
description: config.longDescription,
description: config.description,
openGraph: {
siteName: config.siteName,
title: {
template: "%s",
default: `${config.siteName} ${config.shortDescription}`,
default: `${config.siteName} ${config.tagline}`,
},
url: "/",
locale: config.siteLocale?.replace("-", "_"),
locale: SITE_LOCALE?.replace("-", "_"),
type: "website",
},
twitter: {