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

clean up remaining NEXT_PUBLIC_ environment variables

This commit is contained in:
2025-04-13 16:28:00 -04:00
parent f08aa16862
commit b60fbcc15c
21 changed files with 137 additions and 117 deletions

View File

@@ -1,7 +1,7 @@
import { env } from "../../lib/env";
import { Feed } from "feed";
import { getFrontMatter, getContent } from "./posts";
import * as config from "../config";
import { BASE_URL, RELEASE_TIMESTAMP } from "../config/constants";
import type { Item as FeedItem } from "feed";
import ogImage from "../../app/opengraph-image.jpg";
@@ -12,20 +12,20 @@ import ogImage from "../../app/opengraph-image.jpg";
*/
export const buildFeed = async (): Promise<Feed> => {
const feed = new Feed({
id: `${BASE_URL}`,
link: `${BASE_URL}`,
id: `${env.NEXT_PUBLIC_BASE_URL}`,
link: `${env.NEXT_PUBLIC_BASE_URL}`,
title: config.siteName,
description: config.description,
copyright: config.licenseUrl,
updated: new Date(RELEASE_TIMESTAMP),
image: `${BASE_URL}${ogImage.src}`,
updated: new Date(),
image: `${env.NEXT_PUBLIC_BASE_URL}${ogImage.src}`,
feedLinks: {
rss: `${BASE_URL}/feed.xml`,
atom: `${BASE_URL}/feed.atom`,
rss: `${env.NEXT_PUBLIC_BASE_URL}/feed.xml`,
atom: `${env.NEXT_PUBLIC_BASE_URL}/feed.atom`,
},
author: {
name: config.authorName,
link: BASE_URL,
link: env.NEXT_PUBLIC_BASE_URL,
email: config.authorEmail,
},
});
@@ -41,7 +41,7 @@ export const buildFeed = async (): Promise<Feed> => {
author: [
{
name: config.authorName,
link: `${BASE_URL}`,
link: `${env.NEXT_PUBLIC_BASE_URL}`,
},
],
date: new Date(post.date),

View File

@@ -1,9 +1,9 @@
import { env } from "../env";
import * as config from "../config";
import { BASE_URL, SITE_LOCALE } from "../config/constants";
import type { Metadata } from "next";
export const defaultMetadata: Metadata = {
metadataBase: new URL(BASE_URL),
metadataBase: env.NEXT_PUBLIC_BASE_URL ? new URL(env.NEXT_PUBLIC_BASE_URL) : undefined,
title: {
template: `%s ${config.siteName}`,
default: `${config.siteName} ${config.tagline}`,
@@ -16,7 +16,7 @@ export const defaultMetadata: Metadata = {
default: `${config.siteName} ${config.tagline}`,
},
url: "/",
locale: SITE_LOCALE?.replace("-", "_"),
locale: env.NEXT_PUBLIC_SITE_LOCALE.replace("-", "_"),
type: "website",
},
twitter: {

View File

@@ -1,10 +1,11 @@
import { env } from "../../lib/env";
import path from "path";
import fs from "fs/promises";
import glob from "fast-glob";
import { unified } from "unified";
import { remarkHtml, remarkParse, remarkSmartypants, remarkFrontmatter } from "./remark-rehype-plugins";
import { decode } from "html-entities";
import { BASE_URL, POSTS_DIR } from "../config/constants";
import { POSTS_DIR } from "../config/constants";
export type FrontMatter = {
slug: string;
@@ -77,7 +78,7 @@ Promise<any> => {
slug,
// validate/normalize the date string provided from front matter
date: new Date(frontmatter.date).toISOString(),
permalink: `${BASE_URL}/${POSTS_DIR}/${slug}`,
permalink: `${env.NEXT_PUBLIC_BASE_URL}/${POSTS_DIR}/${slug}`,
} as FrontMatter;
} catch (error) {
console.error(`Failed to load front matter for post with slug "${slug}":`, error);