mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-05 09:05:39 -05:00
test config changes before messing everything up too much
This commit is contained in:
@@ -18,10 +18,10 @@ const Container = ({ title, description, children }: Props) => {
|
|||||||
<NextSeo
|
<NextSeo
|
||||||
title={title}
|
title={title}
|
||||||
description={description}
|
description={description}
|
||||||
canonical={`${config.baseURL}${router.asPath}`}
|
canonical={`${config.baseUrl}${router.asPath}`}
|
||||||
openGraph={{
|
openGraph={{
|
||||||
title: title,
|
title: title,
|
||||||
url: `${config.baseURL}${router.asPath}`,
|
url: `${config.baseUrl}${router.asPath}`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className={styles.container}>{children}</div>
|
<div className={styles.container}>{children}</div>
|
||||||
|
|||||||
@@ -3,22 +3,21 @@ import { getAllNotes } from "./parse-notes";
|
|||||||
import * as config from "./config";
|
import * as config from "./config";
|
||||||
|
|
||||||
export const buildFeed = () => {
|
export const buildFeed = () => {
|
||||||
const baseURL = config.baseURL || "http://localhost:3000"; // necessary for local testing
|
|
||||||
const feed = new Feed({
|
const feed = new Feed({
|
||||||
id: `${baseURL}/`,
|
id: `${config.baseUrl}/`,
|
||||||
link: `${baseURL}/`,
|
link: `${config.baseUrl}/`,
|
||||||
title: config.siteName,
|
title: config.siteName,
|
||||||
description: config.longDescription,
|
description: config.longDescription,
|
||||||
copyright: "https://creativecommons.org/licenses/by/4.0/",
|
copyright: "https://creativecommons.org/licenses/by/4.0/",
|
||||||
updated: new Date(),
|
updated: new Date(),
|
||||||
image: `${baseURL}/static/images/me.jpg`,
|
image: `${config.baseUrl}/static/images/me.jpg`,
|
||||||
feedLinks: {
|
feedLinks: {
|
||||||
rss: `${baseURL}/feed.xml`,
|
rss: `${config.baseUrl}/feed.xml`,
|
||||||
atom: `${baseURL}/feed.atom`,
|
atom: `${config.baseUrl}/feed.atom`,
|
||||||
},
|
},
|
||||||
author: {
|
author: {
|
||||||
name: config.authorName,
|
name: config.authorName,
|
||||||
link: baseURL,
|
link: config.baseUrl,
|
||||||
email: "jake@jarv.is",
|
email: "jake@jarv.is",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -27,14 +26,14 @@ export const buildFeed = () => {
|
|||||||
notes.forEach((note: any) => {
|
notes.forEach((note: any) => {
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title: note.title,
|
title: note.title,
|
||||||
link: `${baseURL}/notes/${note.slug}/`,
|
link: `${config.baseUrl}/notes/${note.slug}/`,
|
||||||
guid: `${baseURL}/notes/${note.slug}/`,
|
guid: `${config.baseUrl}/notes/${note.slug}/`,
|
||||||
description: note.description,
|
description: note.description,
|
||||||
image: note.image ? `${baseURL}${note.image}` : "",
|
image: note.image ? `${config.baseUrl}${note.image}` : "",
|
||||||
author: [
|
author: [
|
||||||
{
|
{
|
||||||
name: config.authorName,
|
name: config.authorName,
|
||||||
link: baseURL,
|
link: config.baseUrl,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
date: new Date(note.date),
|
date: new Date(note.date),
|
||||||
|
|||||||
@@ -1,33 +1,27 @@
|
|||||||
|
module.exports = {
|
||||||
// Site info
|
// Site info
|
||||||
export const siteName = "Jake Jarvis";
|
siteName: "Jake Jarvis",
|
||||||
export const siteDomain = "jarv.is";
|
siteDomain: "jarv.is",
|
||||||
export const shortDescription = "Front-End Web Developer in Boston, MA";
|
onionDomain: "jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion",
|
||||||
export const longDescription =
|
baseUrl: process.env.BASE_URL,
|
||||||
"Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.";
|
shortDescription: "Front-End Web Developer in Boston, MA",
|
||||||
export const themeColorLight = "#fcfcfc";
|
longDescription:
|
||||||
export const themeColorDark = "#252525";
|
"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 githubRepo = "jakejarvis/jarv.is";
|
themeColorLight: "#fcfcfc",
|
||||||
export const fathomSiteId = "WBGNQUKW";
|
themeColorDark: "#252525",
|
||||||
export const fathomCustomDomain = "blue-chilly.jarv.is";
|
githubRepo: "jakejarvis/jarv.is",
|
||||||
|
fathomSiteId: "WBGNQUKW",
|
||||||
let baseURL = ""; // default to relative URLs
|
fathomCustomDomain: "blue-chilly.jarv.is",
|
||||||
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
|
// Me info
|
||||||
export const authorName = "Jake Jarvis";
|
authorName: "Jake Jarvis",
|
||||||
export const twitterHandle = "jakejarvis";
|
twitterHandle: "jakejarvis",
|
||||||
export const facebookAppId = "3357248167622283";
|
facebookAppId: "3357248167622283",
|
||||||
export const webmentionId = "jarv.is";
|
webmentionId: "jarv.is",
|
||||||
export const monetization = "$ilp.uphold.com/BJp6d2FrEB69";
|
monetization: "$ilp.uphold.com/BJp6d2FrEB69",
|
||||||
|
|
||||||
// Next.js constants
|
// Next.js constants
|
||||||
export const NOTES_DIR = "notes";
|
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.
|
||||||
|
};
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ export const getNoteData = (file: string) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
slug: slug,
|
slug,
|
||||||
date: parseISO(data.date).toISOString(), // validate/normalize the date string provided from front matter
|
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
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
|
const config = require("./lib/config");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
siteUrl:
|
siteUrl: config.baseUrl || "https://jarv.is",
|
||||||
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
|
|
||||||
? "https://jarv.is"
|
|
||||||
: `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`,
|
|
||||||
generateRobotsTxt: true,
|
generateRobotsTxt: true,
|
||||||
sitemapSize: 99,
|
sitemapSize: 99,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,15 +3,33 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
|
||||||
|
const config = require("./lib/config");
|
||||||
const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||||
enabled: process.env.ANALYZE === "true",
|
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,
|
swcMinify: true,
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
productionBrowserSourceMaps: true,
|
productionBrowserSourceMaps: true,
|
||||||
|
env: {
|
||||||
|
BASE_URL,
|
||||||
|
},
|
||||||
images: {
|
images: {
|
||||||
formats: ["image/webp"],
|
formats: ["image/webp"],
|
||||||
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
||||||
@@ -47,7 +65,7 @@ module.exports = withBundleAnalyzer({
|
|||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
key: "Onion-Location",
|
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
|
// https://developer.chrome.com/blog/floc/#how-can-websites-opt-out-of-the-floc-computation
|
||||||
@@ -118,3 +136,4 @@ module.exports = withBundleAnalyzer({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ const App = ({ Component, pageProps }: AppProps) => {
|
|||||||
defaultTitle={`${config.siteName} – ${config.shortDescription}`}
|
defaultTitle={`${config.siteName} – ${config.shortDescription}`}
|
||||||
titleTemplate={`%s – ${config.siteName}`}
|
titleTemplate={`%s – ${config.siteName}`}
|
||||||
description={config.longDescription}
|
description={config.longDescription}
|
||||||
canonical={`${config.baseURL}/`}
|
canonical={`${config.baseUrl}/`}
|
||||||
openGraph={{
|
openGraph={{
|
||||||
site_name: config.siteName,
|
site_name: config.siteName,
|
||||||
title: `${config.siteName} – ${config.shortDescription}`,
|
title: `${config.siteName} – ${config.shortDescription}`,
|
||||||
url: `${config.baseURL}/`,
|
url: `${config.baseUrl}/`,
|
||||||
locale: "en_US",
|
locale: "en_US",
|
||||||
type: "website",
|
type: "website",
|
||||||
images: [
|
images: [
|
||||||
{
|
{
|
||||||
url: `${config.baseURL}${meJpg.src}`,
|
url: `${config.baseUrl}${meJpg.src}`,
|
||||||
alt: `${config.siteName} – ${config.shortDescription}`,
|
alt: `${config.siteName} – ${config.shortDescription}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -170,9 +170,9 @@ const App = ({ Component, pageProps }: AppProps) => {
|
|||||||
<SocialProfileJsonLd
|
<SocialProfileJsonLd
|
||||||
type="Person"
|
type="Person"
|
||||||
name="Jake Jarvis"
|
name="Jake Jarvis"
|
||||||
url={`${config.baseURL}/`}
|
url={`${config.baseUrl}/`}
|
||||||
sameAs={[
|
sameAs={[
|
||||||
`${config.baseURL}/`,
|
`${config.baseUrl}/`,
|
||||||
"https://github.com/jakejarvis",
|
"https://github.com/jakejarvis",
|
||||||
"https://keybase.io/jakejarvis",
|
"https://keybase.io/jakejarvis",
|
||||||
"https://twitter.com/jakejarvis",
|
"https://twitter.com/jakejarvis",
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ Sentry.init({
|
|||||||
environment: process.env.NODE_ENV || process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV || "",
|
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) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
try {
|
try {
|
||||||
// permissive access control headers
|
// permissive access control headers
|
||||||
@@ -94,7 +92,7 @@ const getSiteStats = async (client) => {
|
|||||||
// get database and RSS results asynchronously
|
// get database and RSS results asynchronously
|
||||||
const parser = new Parser();
|
const parser = new Parser();
|
||||||
const [feed, result] = await Promise.all([
|
const [feed, result] = await Promise.all([
|
||||||
parser.parseURL(`${BASE_URL}feed.xml`),
|
parser.parseURL(`${config.baseUrl}/feed.xml`),
|
||||||
client.query(
|
client.query(
|
||||||
q.Map(
|
q.Map(
|
||||||
q.Paginate(q.Documents(q.Collection("hits")), { size: 99 }),
|
q.Paginate(q.Documents(q.Collection("hits")), { size: 99 }),
|
||||||
@@ -111,7 +109,7 @@ const getSiteStats = async (client) => {
|
|||||||
|
|
||||||
pages.map((p) => {
|
pages.map((p) => {
|
||||||
// match URLs from RSS feed with db to populate some metadata
|
// 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) {
|
if (match) {
|
||||||
p.title = decode(match.title);
|
p.title = decode(match.title);
|
||||||
p.url = match.link;
|
p.url = match.link;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const Note = ({ source, frontMatter, slug }) => (
|
|||||||
},
|
},
|
||||||
images: [
|
images: [
|
||||||
{
|
{
|
||||||
url: `${config.baseURL}${frontMatter.image}`,
|
url: `${config.baseUrl}${frontMatter.image}`,
|
||||||
alt: frontMatter.title,
|
alt: frontMatter.title,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -44,15 +44,15 @@ const Note = ({ source, frontMatter, slug }) => (
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ArticleJsonLd
|
<ArticleJsonLd
|
||||||
url={`${config.baseURL}/notes/${slug}`}
|
url={`${config.baseUrl}/notes/${slug}`}
|
||||||
title={frontMatter.title}
|
title={frontMatter.title}
|
||||||
description={frontMatter.description}
|
description={frontMatter.description}
|
||||||
datePublished={frontMatter.date}
|
datePublished={frontMatter.date}
|
||||||
dateModified={frontMatter.date}
|
dateModified={frontMatter.date}
|
||||||
images={[`${config.baseURL}${frontMatter.image}`]}
|
images={[`${config.baseUrl}${frontMatter.image}`]}
|
||||||
authorName={[config.authorName]}
|
authorName={[config.authorName]}
|
||||||
publisherName={config.siteName}
|
publisherName={config.siteName}
|
||||||
publisherLogo={`${config.baseURL}/static/images/me.jpg`}
|
publisherLogo={`${config.baseUrl}/static/images/me.jpg`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user