mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-01-14 10:42:56 -05:00
less resource-intensive methods of parsing URLs
This commit is contained in:
@@ -6,6 +6,7 @@ module.exports = {
|
||||
siteLocale: "en-US",
|
||||
timeZone: "America/New_York", // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
|
||||
baseUrl:
|
||||
// NOTE: no trailing slashes!
|
||||
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
|
||||
? "https://jarv.is"
|
||||
: process.env.NEXT_PUBLIC_VERCEL_URL
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import urlJoin from "url-join";
|
||||
import type { StaticImageData } from "next/image";
|
||||
import type { DefaultSeoProps, SocialProfileJsonLdProps, ArticleJsonLdProps } from "next-seo";
|
||||
|
||||
@@ -28,7 +27,7 @@ export const defaultSeo: DefaultSeoProps = {
|
||||
type: "website",
|
||||
images: [
|
||||
{
|
||||
url: urlJoin(config.baseUrl, meJpg.src),
|
||||
url: `${config.baseUrl}${meJpg.src}`,
|
||||
alt: `${config.siteName} – ${config.shortDescription}`,
|
||||
},
|
||||
],
|
||||
@@ -113,9 +112,9 @@ export const defaultSeo: DefaultSeoProps = {
|
||||
export const socialProfileJsonLd: SocialProfileJsonLdProps = {
|
||||
type: "Person",
|
||||
name: config.authorName,
|
||||
url: urlJoin(config.baseUrl, "/"),
|
||||
url: `${config.baseUrl}/`,
|
||||
sameAs: [
|
||||
urlJoin(config.baseUrl, "/"),
|
||||
`${config.baseUrl}/`,
|
||||
`https://github.com/${config.authorSocial?.github}`,
|
||||
`https://keybase.io/${config.authorSocial?.keybase}`,
|
||||
`https://twitter.com/${config.authorSocial?.twitter}`,
|
||||
@@ -131,7 +130,7 @@ export const socialProfileJsonLd: SocialProfileJsonLdProps = {
|
||||
export const articleJsonLd: Pick<ArticleJsonLdProps, "authorName" | "publisherName" | "publisherLogo"> = {
|
||||
authorName: [config.authorName],
|
||||
publisherName: config.siteName,
|
||||
publisherLogo: urlJoin(config.baseUrl, meJpg.src),
|
||||
publisherLogo: `${config.baseUrl}${meJpg.src}`,
|
||||
};
|
||||
|
||||
// Re-export icons to use their static image data elsewhere
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Feed } from "feed";
|
||||
import urlJoin from "url-join";
|
||||
import { getAllNotes } from "./parse-notes";
|
||||
import * as config from "../config";
|
||||
import { RELEASE_DATE } from "../config/constants";
|
||||
@@ -22,20 +21,20 @@ export const buildFeed = async (
|
||||
|
||||
// https://github.com/jpmonette/feed#example
|
||||
const feed = new Feed({
|
||||
id: urlJoin(config.baseUrl, "/"),
|
||||
link: urlJoin(config.baseUrl, "/"),
|
||||
id: `${config.baseUrl}/`,
|
||||
link: `${config.baseUrl}/`,
|
||||
title: config.siteName,
|
||||
description: config.longDescription,
|
||||
copyright: "https://creativecommons.org/licenses/by/4.0/",
|
||||
updated: new Date(RELEASE_DATE),
|
||||
image: urlJoin(config.baseUrl, favicons.meJpg.src),
|
||||
image: `${config.baseUrl}${favicons.meJpg.src}`,
|
||||
feedLinks: {
|
||||
rss: urlJoin(config.baseUrl, "feed.xml"),
|
||||
atom: urlJoin(config.baseUrl, "feed.atom"),
|
||||
rss: `${config.baseUrl}/feed.xml`,
|
||||
atom: `${config.baseUrl}/feed.atom`,
|
||||
},
|
||||
author: {
|
||||
name: config.authorName,
|
||||
link: urlJoin(config.baseUrl, "/"),
|
||||
link: `${config.baseUrl}/`,
|
||||
email: config.authorEmail,
|
||||
},
|
||||
});
|
||||
@@ -48,11 +47,11 @@ export const buildFeed = async (
|
||||
link: note.permalink,
|
||||
title: note.title,
|
||||
description: note.description,
|
||||
image: note.image ? urlJoin(config.baseUrl, note.image) : "",
|
||||
image: note.image ? `${config.baseUrl}${note.image}` : "",
|
||||
author: [
|
||||
{
|
||||
name: config.authorName,
|
||||
link: urlJoin(config.baseUrl, "/"),
|
||||
link: `${config.baseUrl}/`,
|
||||
},
|
||||
],
|
||||
date: new Date(note.date),
|
||||
|
||||
@@ -5,7 +5,6 @@ import { serialize } from "next-mdx-remote/serialize";
|
||||
import glob from "fast-glob";
|
||||
import pMap from "p-map";
|
||||
import matter from "gray-matter";
|
||||
import urlJoin from "url-join";
|
||||
import { minify } from "uglify-js";
|
||||
import { compiler } from "markdown-to-jsx";
|
||||
import removeMarkdown from "remove-markdown";
|
||||
@@ -66,7 +65,7 @@ export const getNoteData = async (
|
||||
// parsed markdown title:
|
||||
htmlTitle,
|
||||
slug,
|
||||
permalink: urlJoin(baseUrl, "notes", slug, "/"),
|
||||
permalink: `${baseUrl}/notes/${slug}/`,
|
||||
date: formatDateISO(data.date), // validate/normalize the date string provided from front matter
|
||||
},
|
||||
content,
|
||||
|
||||
Reference in New Issue
Block a user