1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-11-05 07:05:40 -05:00

test config changes before messing everything up too much

This commit is contained in:
2022-01-03 09:59:42 -05:00
parent c708383afb
commit 36e3cfa18e
9 changed files with 178 additions and 169 deletions

View File

@@ -18,10 +18,10 @@ const Container = ({ title, description, children }: Props) => {
<NextSeo
title={title}
description={description}
canonical={`${config.baseURL}${router.asPath}`}
canonical={`${config.baseUrl}${router.asPath}`}
openGraph={{
title: title,
url: `${config.baseURL}${router.asPath}`,
url: `${config.baseUrl}${router.asPath}`,
}}
/>
<div className={styles.container}>{children}</div>

View File

@@ -3,22 +3,21 @@ import { getAllNotes } from "./parse-notes";
import * as config from "./config";
export const buildFeed = () => {
const baseURL = config.baseURL || "http://localhost:3000"; // necessary for local testing
const feed = new Feed({
id: `${baseURL}/`,
link: `${baseURL}/`,
id: `${config.baseUrl}/`,
link: `${config.baseUrl}/`,
title: config.siteName,
description: config.longDescription,
copyright: "https://creativecommons.org/licenses/by/4.0/",
updated: new Date(),
image: `${baseURL}/static/images/me.jpg`,
image: `${config.baseUrl}/static/images/me.jpg`,
feedLinks: {
rss: `${baseURL}/feed.xml`,
atom: `${baseURL}/feed.atom`,
rss: `${config.baseUrl}/feed.xml`,
atom: `${config.baseUrl}/feed.atom`,
},
author: {
name: config.authorName,
link: baseURL,
link: config.baseUrl,
email: "jake@jarv.is",
},
});
@@ -27,14 +26,14 @@ export const buildFeed = () => {
notes.forEach((note: any) => {
feed.addItem({
title: note.title,
link: `${baseURL}/notes/${note.slug}/`,
guid: `${baseURL}/notes/${note.slug}/`,
link: `${config.baseUrl}/notes/${note.slug}/`,
guid: `${config.baseUrl}/notes/${note.slug}/`,
description: note.description,
image: note.image ? `${baseURL}${note.image}` : "",
image: note.image ? `${config.baseUrl}${note.image}` : "",
author: [
{
name: config.authorName,
link: baseURL,
link: config.baseUrl,
},
],
date: new Date(note.date),

View File

@@ -1,33 +1,27 @@
// Site info
export const siteName = "Jake Jarvis";
export const siteDomain = "jarv.is";
export const shortDescription = "Front-End Web Developer in Boston, MA";
export const longDescription =
"Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.";
export const themeColorLight = "#fcfcfc";
export const themeColorDark = "#252525";
export const githubRepo = "jakejarvis/jarv.is";
export const fathomSiteId = "WBGNQUKW";
export const fathomCustomDomain = "blue-chilly.jarv.is";
module.exports = {
// Site info
siteName: "Jake Jarvis",
siteDomain: "jarv.is",
onionDomain: "jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion",
baseUrl: process.env.BASE_URL,
shortDescription: "Front-End Web Developer in Boston, MA",
longDescription:
"Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.",
themeColorLight: "#fcfcfc",
themeColorDark: "#252525",
githubRepo: "jakejarvis/jarv.is",
fathomSiteId: "WBGNQUKW",
fathomCustomDomain: "blue-chilly.jarv.is",
let baseURL = ""; // default to relative URLs
if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") {
// vercel production (set manually above)
baseURL = `https://${siteDomain}`;
} else if (process.env.NEXT_PUBLIC_VERCEL_URL) {
// vercel deploy previews
baseURL = `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;
}
export { baseURL };
// Me info
authorName: "Jake Jarvis",
twitterHandle: "jakejarvis",
facebookAppId: "3357248167622283",
webmentionId: "jarv.is",
monetization: "$ilp.uphold.com/BJp6d2FrEB69",
// Me info
export const authorName = "Jake Jarvis";
export const twitterHandle = "jakejarvis";
export const facebookAppId = "3357248167622283";
export const webmentionId = "jarv.is";
export const monetization = "$ilp.uphold.com/BJp6d2FrEB69";
// Next.js constants
NOTES_DIR: "./notes",
// Next.js constants
export const NOTES_DIR = "notes";
// ...note / TODO: there is still a metric poop ton of this kind of info hard-coded.
// ...note / TODO: there is still a metric poop ton of this kind of info hard-coded.
};

View File

@@ -12,9 +12,9 @@ export const getNoteData = (file: string) => {
return {
...data,
slug: slug,
slug,
date: parseISO(data.date).toISOString(), // validate/normalize the date string provided from front matter
year: parseInt(format(parseISO(data.date), "yyyy")),
year: parseInt(format(parseISO(data.date), "yyyy")), // parse years here so it's easier to group them on list page
};
};

View File

@@ -1,8 +1,7 @@
const config = require("./lib/config");
module.exports = {
siteUrl:
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
? "https://jarv.is"
: `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`,
siteUrl: config.baseUrl || "https://jarv.is",
generateRobotsTxt: true,
sitemapSize: 99,
};

View File

@@ -3,15 +3,33 @@
*/
const path = require("path");
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
const config = require("./lib/config");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer({
module.exports = (phase) => {
let BASE_URL = ""; // fallback to relative urls
if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") {
// vercel production (set manually)
BASE_URL = `https://jarv.is`;
} else if (process.env.NEXT_PUBLIC_VERCEL_URL) {
// vercel deploy previews
BASE_URL = `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;
} else if (phase === PHASE_DEVELOPMENT_SERVER) {
// local dev server
BASE_URL = "http://localhost:3000";
}
return withBundleAnalyzer({
swcMinify: true,
reactStrictMode: true,
trailingSlash: true,
productionBrowserSourceMaps: true,
env: {
BASE_URL,
},
images: {
formats: ["image/webp"],
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
@@ -47,7 +65,7 @@ module.exports = withBundleAnalyzer({
headers: [
{
key: "Onion-Location",
value: "http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion/:path*",
value: `http://${config.onionDomain}/:path*`,
},
{
// https://developer.chrome.com/blog/floc/#how-can-websites-opt-out-of-the-floc-computation
@@ -117,4 +135,5 @@ module.exports = withBundleAnalyzer({
permanent: true,
},
],
});
});
};

View File

@@ -49,16 +49,16 @@ const App = ({ Component, pageProps }: AppProps) => {
defaultTitle={`${config.siteName} ${config.shortDescription}`}
titleTemplate={`%s ${config.siteName}`}
description={config.longDescription}
canonical={`${config.baseURL}/`}
canonical={`${config.baseUrl}/`}
openGraph={{
site_name: config.siteName,
title: `${config.siteName} ${config.shortDescription}`,
url: `${config.baseURL}/`,
url: `${config.baseUrl}/`,
locale: "en_US",
type: "website",
images: [
{
url: `${config.baseURL}${meJpg.src}`,
url: `${config.baseUrl}${meJpg.src}`,
alt: `${config.siteName} ${config.shortDescription}`,
},
],
@@ -170,9 +170,9 @@ const App = ({ Component, pageProps }: AppProps) => {
<SocialProfileJsonLd
type="Person"
name="Jake Jarvis"
url={`${config.baseURL}/`}
url={`${config.baseUrl}/`}
sameAs={[
`${config.baseURL}/`,
`${config.baseUrl}/`,
"https://github.com/jakejarvis",
"https://keybase.io/jakejarvis",
"https://twitter.com/jakejarvis",

View File

@@ -12,8 +12,6 @@ Sentry.init({
environment: process.env.NODE_ENV || process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV || "",
});
const BASE_URL = config.baseURL === "" ? `https://${config.siteDomain}/` : `${config.baseURL}/`;
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
// permissive access control headers
@@ -94,7 +92,7 @@ const getSiteStats = async (client) => {
// get database and RSS results asynchronously
const parser = new Parser();
const [feed, result] = await Promise.all([
parser.parseURL(`${BASE_URL}feed.xml`),
parser.parseURL(`${config.baseUrl}/feed.xml`),
client.query(
q.Map(
q.Paginate(q.Documents(q.Collection("hits")), { size: 99 }),
@@ -111,7 +109,7 @@ const getSiteStats = async (client) => {
pages.map((p) => {
// match URLs from RSS feed with db to populate some metadata
const match = feed.items.find((x) => x.link === `${BASE_URL}${p.slug}/`);
const match = feed.items.find((x) => x.link === `${config.baseUrl}/${p.slug}/`);
if (match) {
p.title = decode(match.title);
p.url = match.link;

View File

@@ -32,7 +32,7 @@ const Note = ({ source, frontMatter, slug }) => (
},
images: [
{
url: `${config.baseURL}${frontMatter.image}`,
url: `${config.baseUrl}${frontMatter.image}`,
alt: frontMatter.title,
},
],
@@ -44,15 +44,15 @@ const Note = ({ source, frontMatter, slug }) => (
}}
/>
<ArticleJsonLd
url={`${config.baseURL}/notes/${slug}`}
url={`${config.baseUrl}/notes/${slug}`}
title={frontMatter.title}
description={frontMatter.description}
datePublished={frontMatter.date}
dateModified={frontMatter.date}
images={[`${config.baseURL}${frontMatter.image}`]}
images={[`${config.baseUrl}${frontMatter.image}`]}
authorName={[config.authorName]}
publisherName={config.siteName}
publisherLogo={`${config.baseURL}/static/images/me.jpg`}
publisherLogo={`${config.baseUrl}/static/images/me.jpg`}
/>
<Layout>