1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 14:46:37 -04:00

refactor favicon imports

This commit is contained in:
2022-11-13 19:11:30 -05:00
parent c339b4df63
commit d4b806dfcf
7 changed files with 71 additions and 79 deletions

View File

@ -8,7 +8,8 @@ import * as mdxComponents from "../../lib/helpers/mdx-components";
import { getNoteSlugs } from "../../lib/helpers/parse-notes";
import { compileNote } from "../../lib/helpers/compile-note";
import * as config from "../../lib/config";
import { articleJsonLd, favicons } from "../../lib/config/seo";
import { articleJsonLd } from "../../lib/config/seo";
import { meJpg } from "../../lib/config/favicons";
import type { GetStaticProps, GetStaticPaths, InferGetStaticPropsType } from "next";
import type { NoteWithSource, NoteFrontMatter } from "../../types";
@ -31,7 +32,7 @@ const Note = ({ frontMatter, source }: InferGetStaticPropsType<typeof getStaticP
},
images: [
{
url: `${config.baseUrl}${frontMatter.image || favicons.meJpg.src}`,
url: `${config.baseUrl}${frontMatter.image || meJpg.src}`,
alt: frontMatter.title,
},
],
@ -46,7 +47,7 @@ const Note = ({ frontMatter, source }: InferGetStaticPropsType<typeof getStaticP
description={frontMatter.description || config.longDescription}
datePublished={frontMatter.date}
dateModified={frontMatter.date}
images={[`${config.baseUrl}${frontMatter.image || favicons.meJpg.src}`]}
images={[`${config.baseUrl}${frontMatter.image || meJpg.src}`]}
{...articleJsonLd}
/>

View File

@ -1,5 +1,5 @@
import * as config from "../lib/config";
import { favicons } from "../lib/config/seo";
import { chrome512Png, chrome192Png, maskable512Png, maskable192Png } from "../lib/config/favicons";
import type { GetServerSideProps } from "next";
export const getServerSideProps: GetServerSideProps<Record<string, never>> = async (context) => {
@ -17,26 +17,26 @@ export const getServerSideProps: GetServerSideProps<Record<string, never>> = asy
lang: config.siteLocale,
icons: [
{
src: favicons.chrome512Png.src,
sizes: `${favicons.chrome512Png.width}x${favicons.chrome512Png.height}`,
src: chrome512Png.src,
sizes: `${chrome512Png.width}x${chrome512Png.height}`,
type: "image/png",
purpose: "any",
},
{
src: favicons.chrome192Png.src,
sizes: `${favicons.chrome192Png.width}x${favicons.chrome192Png.height}`,
src: chrome192Png.src,
sizes: `${chrome192Png.width}x${chrome192Png.height}`,
type: "image/png",
purpose: "any",
},
{
src: favicons.maskable512Png.src,
sizes: `${favicons.maskable512Png.width}x${favicons.maskable512Png.height}`,
src: maskable512Png.src,
sizes: `${maskable512Png.width}x${maskable512Png.height}`,
type: "image/png",
purpose: "maskable",
},
{
src: favicons.maskable192Png.src,
sizes: `${favicons.maskable192Png.width}x${favicons.maskable192Png.height}`,
src: maskable192Png.src,
sizes: `${maskable192Png.width}x${maskable192Png.height}`,
type: "image/png",
purpose: "maskable",
},