1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-14 01:55:31 -04:00

dynamic site.webmanifest

This commit is contained in:
2022-01-03 11:42:03 -05:00
parent 36e3cfa18e
commit 55d9207753
9 changed files with 72 additions and 60 deletions

View File

@@ -17,8 +17,8 @@ export const buildFeed = () => {
}, },
author: { author: {
name: config.authorName, name: config.authorName,
link: config.baseUrl, link: `${config.baseUrl}/`,
email: "jake@jarv.is", email: config.authorEmail,
}, },
}); });

View File

@@ -2,23 +2,34 @@ module.exports = {
// Site info // Site info
siteName: "Jake Jarvis", siteName: "Jake Jarvis",
siteDomain: "jarv.is", siteDomain: "jarv.is",
siteLocale: "en_us",
baseUrl: process.env.BASE_URL || "https://jarv.is",
onionDomain: "jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion", onionDomain: "jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion",
baseUrl: process.env.BASE_URL,
shortDescription: "Front-End Web Developer in Boston, MA", shortDescription: "Front-End Web Developer in Boston, MA",
longDescription: longDescription:
"Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.", "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.",
themeColorLight: "#fcfcfc", themeColorLight: "#fcfcfc",
themeColorDark: "#252525", themeColorDark: "#252525",
githubRepo: "jakejarvis/jarv.is", githubRepo: "jakejarvis/jarv.is",
facebookAppId: "3357248167622283",
monetization: "$ilp.uphold.com/BJp6d2FrEB69",
fathomSiteId: "WBGNQUKW", fathomSiteId: "WBGNQUKW",
fathomCustomDomain: "blue-chilly.jarv.is", fathomCustomDomain: "blue-chilly.jarv.is",
webmentionId: "jarv.is",
// Me info // Me info
authorName: "Jake Jarvis", authorName: "Jake Jarvis",
twitterHandle: "jakejarvis", authorEmail: "jake@jarv.is",
facebookAppId: "3357248167622283", authorSocial: {
webmentionId: "jarv.is", github: "jakejarvis",
monetization: "$ilp.uphold.com/BJp6d2FrEB69", twitter: "jakejarvis",
facebook: "jakejarvis",
keybase: "jakejarvis",
medium: "jakejarvis",
linkedin: "jakejarvis",
instagram: "jakejarvis",
mastodon: "mastodon.social/@jakejarvis",
},
// Next.js constants // Next.js constants
NOTES_DIR: "./notes", NOTES_DIR: "./notes",

View File

@@ -1,7 +1,7 @@
const config = require("./lib/config"); const config = require("./lib/config");
module.exports = { module.exports = {
siteUrl: config.baseUrl || "https://jarv.is", siteUrl: config.baseUrl || "",
generateRobotsTxt: true, generateRobotsTxt: true,
sitemapSize: 99, sitemapSize: 99,
}; };

View File

@@ -54,7 +54,7 @@ const App = ({ Component, pageProps }: AppProps) => {
site_name: config.siteName, site_name: config.siteName,
title: `${config.siteName} ${config.shortDescription}`, title: `${config.siteName} ${config.shortDescription}`,
url: `${config.baseUrl}/`, url: `${config.baseUrl}/`,
locale: "en_US", locale: config.siteLocale,
type: "website", type: "website",
images: [ images: [
{ {
@@ -64,8 +64,8 @@ const App = ({ Component, pageProps }: AppProps) => {
], ],
}} }}
twitter={{ twitter={{
handle: `@${config.twitterHandle}`, handle: `@${config.authorSocial.twitter}`,
site: `@${config.twitterHandle}`, site: `@${config.authorSocial.twitter}`,
cardType: "summary", cardType: "summary",
}} }}
facebook={{ facebook={{
@@ -169,18 +169,18 @@ const App = ({ Component, pageProps }: AppProps) => {
/> />
<SocialProfileJsonLd <SocialProfileJsonLd
type="Person" type="Person"
name="Jake Jarvis" name={config.authorName}
url={`${config.baseUrl}/`} url={`${config.baseUrl}/`}
sameAs={[ sameAs={[
`${config.baseUrl}/`, `${config.baseUrl}/`,
"https://github.com/jakejarvis", `https://github.com/${config.authorSocial.github}`,
"https://keybase.io/jakejarvis", `https://keybase.io/${config.authorSocial.keybase}`,
"https://twitter.com/jakejarvis", `https://twitter.com/${config.authorSocial.twitter}`,
"https://medium.com/@jakejarvis", `https://medium.com/@${config.authorSocial.medium}`,
"https://www.linkedin.com/in/jakejarvis/", `https://www.linkedin.com/in/${config.authorSocial.linkedin}/`,
"https://www.facebook.com/jakejarvis", `https://www.facebook.com/${config.authorSocial.facebook}`,
"https://www.instagram.com/jakejarvis/", `https://www.instagram.com/${config.authorSocial.instagram}/`,
"https://mastodon.social/@jakejarvis", `https://${config.authorSocial.mastodon}`,
]} ]}
/> />

View File

@@ -1,7 +1,7 @@
import { buildFeed } from "../lib/build-feed"; import { buildFeed } from "../lib/build-feed";
import type { GetServerSideProps } from "next"; import type { GetServerSideProps } from "next";
const AtomPage = () => null; const AtomFeed = () => null;
export const getServerSideProps: GetServerSideProps = async (context) => { export const getServerSideProps: GetServerSideProps = async (context) => {
const feed = buildFeed(); const feed = buildFeed();
@@ -16,4 +16,4 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}; };
}; };
export default AtomPage; export default AtomFeed;

View File

@@ -1,7 +1,7 @@
import { buildFeed } from "../lib/build-feed"; import { buildFeed } from "../lib/build-feed";
import type { GetServerSideProps } from "next"; import type { GetServerSideProps } from "next";
const RssPage = () => null; const RssFeed = () => null;
export const getServerSideProps: GetServerSideProps = async (context) => { export const getServerSideProps: GetServerSideProps = async (context) => {
const feed = buildFeed(); const feed = buildFeed();
@@ -16,4 +16,4 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}; };
}; };
export default RssPage; export default RssFeed;

View File

@@ -38,8 +38,8 @@ const Note = ({ source, frontMatter, slug }) => (
], ],
}} }}
twitter={{ twitter={{
handle: `@${config.twitterHandle}`, handle: `@${config.authorSocial.twitter}`,
site: `@${config.twitterHandle}`, site: `@${config.authorSocial.twitter}`,
cardType: "summary_large_image", cardType: "summary_large_image",
}} }}
/> />

35
pages/site.webmanifest.ts Normal file
View File

@@ -0,0 +1,35 @@
import * as config from "../lib/config";
import type { GetServerSideProps } from "next";
const SiteManifest = () => null;
export const getServerSideProps: GetServerSideProps = async (context) => {
const manifest = {
name: config.siteName,
short_name: config.siteDomain,
description: config.longDescription,
lang: config.siteLocale,
icons: [
{ src: "/static/favicons/android-chrome-512x512.png", sizes: "512x512", type: "image/png", purpose: "any" },
{ src: "/static/favicons/android-chrome-192x192.png", sizes: "192x192", type: "image/png", purpose: "any" },
{ src: "/static/favicons/maskable-512x512.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
{ src: "/static/favicons/maskable-192x192.png", sizes: "192x192", type: "image/png", purpose: "maskable" },
],
display: "browser",
start_url: "/",
};
const { res } = context;
// https://developer.mozilla.org/en-US/docs/Web/Manifest#deploying_a_manifest
res.setHeader("content-type", "application/manifest+json");
// cache for one day
res.setHeader("cache-control", "s-maxage=86400, stale-while-revalidate");
res.write(JSON.stringify(manifest));
res.end();
return {
props: {},
};
};
export default SiteManifest;

View File

@@ -1,34 +0,0 @@
{
"name": "Jake Jarvis",
"short_name": "jarv.is",
"description": "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps.",
"lang": "en-us",
"icons": [
{
"src": "/static/favicons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static/favicons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static/favicons/maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/static/favicons/maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
}
],
"display": "browser",
"start_url": "/"
}