1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-16 19:45:33 -04:00

use safer method of concatenating absolute URLs

This commit is contained in:
2022-04-07 15:29:15 -04:00
parent 1d3727cca0
commit a8c1a3ba3c
9 changed files with 136 additions and 123 deletions

View File

@@ -3,6 +3,7 @@ import path from "path";
import { renderToStaticMarkup } from "react-dom/server";
import matter from "gray-matter";
import { serialize } from "next-mdx-remote/serialize";
import urlJoin from "url-join";
import { minify } from "terser";
import { compiler } from "markdown-to-jsx";
import removeMarkdown from "remove-markdown";
@@ -54,7 +55,7 @@ export const getNoteData = (slug: string): Omit<NoteType, "source"> & { content:
// parsed markdown title:
htmlTitle,
slug,
permalink: `${baseUrl}/notes/${slug}/`,
permalink: urlJoin(baseUrl, "notes", slug, "/"),
date: new Date(data.date).toISOString(), // validate/normalize the date string provided from front matter
readingMins: Math.ceil(readingTime(content).minutes),
},