mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 13:55:31 -04:00
pre-render optimizations
This commit is contained in:
@@ -1,26 +1,27 @@
|
||||
import { Feed } from "feed";
|
||||
import { getAllPosts } from "./posts";
|
||||
import config from "../config";
|
||||
import * as config from "../config";
|
||||
import { BASE_URL } from "../config/constants";
|
||||
|
||||
import meJpg from "../../public/static/me.jpg";
|
||||
import ogImage from "../../app/opengraph-image.jpg";
|
||||
|
||||
export const buildFeed = async (): Promise<Feed> => {
|
||||
// https://github.com/jpmonette/feed#example
|
||||
const feed = new Feed({
|
||||
id: config.baseUrl,
|
||||
link: config.baseUrl,
|
||||
id: BASE_URL,
|
||||
link: BASE_URL,
|
||||
title: config.siteName,
|
||||
description: config.longDescription,
|
||||
copyright: config.licenseUrl,
|
||||
updated: new Date(process.env.RELEASE_DATE || Date.now()),
|
||||
image: `${config.baseUrl}${meJpg.src}`,
|
||||
image: `${BASE_URL}${ogImage.src}`,
|
||||
feedLinks: {
|
||||
rss: `${config.baseUrl}/feed.xml`,
|
||||
atom: `${config.baseUrl}/feed.atom`,
|
||||
rss: `${BASE_URL}/feed.xml`,
|
||||
atom: `${BASE_URL}/feed.atom`,
|
||||
},
|
||||
author: {
|
||||
name: config.authorName,
|
||||
link: config.baseUrl,
|
||||
link: BASE_URL,
|
||||
email: config.authorEmail,
|
||||
},
|
||||
});
|
||||
@@ -35,7 +36,7 @@ export const buildFeed = async (): Promise<Feed> => {
|
||||
author: [
|
||||
{
|
||||
name: config.authorName,
|
||||
link: config.baseUrl,
|
||||
link: BASE_URL,
|
||||
},
|
||||
],
|
||||
date: new Date(post.date),
|
||||
|
@@ -5,7 +5,7 @@ import dayjsRelativeTime from "dayjs/plugin/relativeTime";
|
||||
import dayjsLocalizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import dayjsAdvancedFormat from "dayjs/plugin/advancedFormat";
|
||||
import "dayjs/locale/en";
|
||||
import config from "../config";
|
||||
import * as config from "../config";
|
||||
|
||||
const IsomorphicDayJs = (date?: dayjs.ConfigType): dayjs.Dayjs => {
|
||||
// plugins
|
||||
|
@@ -3,10 +3,7 @@ import glob from "fast-glob";
|
||||
import pMap from "p-map";
|
||||
import pMemoize from "p-memoize";
|
||||
import { formatDate } from "./format-date";
|
||||
import config from "../config";
|
||||
|
||||
// path to directory with .mdx files, relative to project root
|
||||
const POSTS_DIR = "notes";
|
||||
import { BASE_URL, POSTS_DIR } from "../config/constants";
|
||||
|
||||
export type FrontMatter = {
|
||||
slug: string;
|
||||
@@ -65,7 +62,7 @@ export const getFrontMatter = async (slug: string): Promise<FrontMatter> => {
|
||||
htmlTitle,
|
||||
slug,
|
||||
date: formatDate(frontmatter.date), // validate/normalize the date string provided from front matter
|
||||
permalink: `${config.baseUrl}/${POSTS_DIR}/${slug}`,
|
||||
permalink: `${BASE_URL}/${POSTS_DIR}/${slug}`,
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user