mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 13:55:31 -04:00
dynamic opengraph images
This commit is contained in:
@@ -2,7 +2,7 @@ import { Feed } from "feed";
|
||||
import { getAllPosts } from "./posts";
|
||||
import config from "../config";
|
||||
|
||||
import meJpg from "../../app/me.jpg";
|
||||
import meJpg from "../../public/static/me.jpg";
|
||||
|
||||
export const buildFeed = async (): Promise<Feed> => {
|
||||
// https://github.com/jpmonette/feed#example
|
||||
@@ -32,7 +32,6 @@ export const buildFeed = async (): Promise<Feed> => {
|
||||
link: post.permalink,
|
||||
title: post.title,
|
||||
description: post.description,
|
||||
image: post.image || undefined,
|
||||
author: [
|
||||
{
|
||||
name: config.authorName,
|
||||
|
@@ -15,13 +15,17 @@ export type FrontMatter = {
|
||||
title: string;
|
||||
htmlTitle?: string;
|
||||
description?: string;
|
||||
image?: string;
|
||||
tags?: string[];
|
||||
image?: string;
|
||||
noComments?: boolean;
|
||||
};
|
||||
|
||||
// returns front matter and the **raw & uncompiled** markdown of a given slug
|
||||
export const getFrontMatter = async (slug: string): Promise<FrontMatter> => {
|
||||
if (!(await getPostSlugs()).includes(slug)) {
|
||||
throw new Error(`No post found for slug: ${slug}`);
|
||||
}
|
||||
|
||||
const { frontmatter } = await import(`../../${POSTS_DIR}/${slug}/index.mdx`);
|
||||
|
||||
const { unified } = await import("unified");
|
||||
@@ -62,7 +66,6 @@ export const getFrontMatter = async (slug: string): Promise<FrontMatter> => {
|
||||
slug,
|
||||
date: formatDate(frontmatter.date), // validate/normalize the date string provided from front matter
|
||||
permalink: `${config.baseUrl}/${POSTS_DIR}/${slug}`,
|
||||
image: frontmatter.image ? `${config.baseUrl}${frontmatter.image}` : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user