mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Improve metadata
Add JSON LD, make homepage h-card representative, Fix bug with byline fix incorrect OG image aspect ratio in meta Add og site_name Add author profile image
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
"rollup": "^4.18.0",
|
"rollup": "^4.18.0",
|
||||||
"rollup-plugin-type-as-json-schema": "^0.2.6",
|
"rollup-plugin-type-as-json-schema": "^0.2.6",
|
||||||
"rollup-plugin-visualizer": "^5.12.0",
|
"rollup-plugin-visualizer": "^5.12.0",
|
||||||
|
"schema-dts": "^1.1.2",
|
||||||
"sharp": "^0.33.4",
|
"sharp": "^0.33.4",
|
||||||
"svelte": "^4.2.18",
|
"svelte": "^4.2.18",
|
||||||
"svelte-check": "^3.8.0",
|
"svelte-check": "^3.8.0",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="hero card edge h-card">
|
<div class="hero card edge h-card">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<a href={SITE_URL} class="u-url"><img class="u-photo" src={url} alt="Logo" /></a>
|
<a href={SITE_URL} class="u-url u-uid" rel="me"><img class="u-photo" src={url} alt="Logo" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { dev } from '$app/environment';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const SITE_TITLE = 'JadedBlueEyes';
|
export const SITE_TITLE = "Jade's Website";
|
||||||
|
|
||||||
export const SITE_URL = dev ? "http://localhost:5173" : "https://jade.ellis.link"
|
export const SITE_URL = dev ? "http://localhost:5173" : "https://jade.ellis.link"
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
import "$lib/styles.css";
|
import "$lib/styles.css";
|
||||||
import Favicons from "$lib/Favicons.svelte";
|
import Favicons from "$lib/Favicons.svelte";
|
||||||
import Nav from "$lib/Nav.svelte";
|
import Nav from "$lib/Nav.svelte";
|
||||||
|
import { SITE_TITLE } from "$lib/metadata"
|
||||||
</script>
|
</script>
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<Favicons />
|
<Favicons />
|
||||||
<link rel="webmention" href="https://webmention.io/jade.ellis.link/webmention" />
|
<link rel="webmention" href="https://webmention.io/jade.ellis.link/webmention" />
|
||||||
|
<meta property="og:site_name" content={SITE_TITLE}>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
<Nav />
|
<Nav />
|
||||||
<main class="main container" id="page-content">
|
<main class="main container" id="page-content">
|
||||||
|
|||||||
@@ -6,13 +6,20 @@
|
|||||||
export let data;
|
export let data;
|
||||||
import { SITE_URL, SITE_TITLE } from "$lib/metadata";
|
import { SITE_URL, SITE_TITLE } from "$lib/metadata";
|
||||||
import Toc from "$lib/Toc.svelte";
|
import Toc from "$lib/Toc.svelte";
|
||||||
|
import type { WithContext, Thing } from "schema-dts";
|
||||||
|
import pfpUrl from "$lib/logo.svg?url";
|
||||||
// let GhReleasesDownload: Promise<any>;
|
// let GhReleasesDownload: Promise<any>;
|
||||||
// if (data.ghReleaseData) {
|
// if (data.ghReleaseData) {
|
||||||
// GhReleasesDownload = import("$lib/GhReleasesDownload.svelte").then((m) => m.default)
|
// GhReleasesDownload = import("$lib/GhReleasesDownload.svelte").then((m) => m.default)
|
||||||
// }
|
// }
|
||||||
$: canonical = SITE_URL + "/blog/" + data.post.canonical;
|
$: canonical = SITE_URL + "/blog/" + data.post.canonical;
|
||||||
|
|
||||||
function calcOgURL(slug: string, date: string, ratio?: number, width?: number): URL {
|
function calcOgURL(
|
||||||
|
slug: string,
|
||||||
|
date: string,
|
||||||
|
ratio?: number,
|
||||||
|
width?: number,
|
||||||
|
): URL {
|
||||||
let url = new URL(SITE_URL + "/blog/image");
|
let url = new URL(SITE_URL + "/blog/image");
|
||||||
url.searchParams.set("slug", slug);
|
url.searchParams.set("slug", slug);
|
||||||
url.searchParams.set("date", date);
|
url.searchParams.set("date", date);
|
||||||
@@ -44,10 +51,62 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const defaultAuthor = {
|
const defaultAuthor = {
|
||||||
|
"@type": "Person",
|
||||||
name: "Jade Ellis",
|
name: "Jade Ellis",
|
||||||
url: "https://jade.ellis.link",
|
url: "https://jade.ellis.link",
|
||||||
fediverse: "@JadedBlueEyes@tech.lgbt",
|
fediverse: "@JadedBlueEyes@tech.lgbt",
|
||||||
|
image: pfpUrl,
|
||||||
};
|
};
|
||||||
|
$: jsonLd = {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "WebPage",
|
||||||
|
breadcrumb: {
|
||||||
|
"@type": "BreadcrumbList",
|
||||||
|
|
||||||
|
itemListElement: [
|
||||||
|
{
|
||||||
|
"@type": "ListItem",
|
||||||
|
position: 1,
|
||||||
|
name: "Blog",
|
||||||
|
item: SITE_URL + "/blog",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "ListItem",
|
||||||
|
position: 2,
|
||||||
|
name: data.post.title,
|
||||||
|
item: canonical,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
mainEntity: {
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
"@id": canonical,
|
||||||
|
url: canonical,
|
||||||
|
mainEntityOfPage: canonical,
|
||||||
|
name: data.post.title,
|
||||||
|
headline: data.post.title,
|
||||||
|
datePublished: new Date(data.post.date).toISOString(),
|
||||||
|
author: defaultAuthor,
|
||||||
|
description: data.post.description,
|
||||||
|
wordCount: data.post.readingTime.words,
|
||||||
|
image: {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
width: "1200",
|
||||||
|
height: "630",
|
||||||
|
url: calcOgURL(
|
||||||
|
data.post.slug,
|
||||||
|
data.post.date,
|
||||||
|
630 / 1200,
|
||||||
|
1200,
|
||||||
|
).toString(),
|
||||||
|
},
|
||||||
|
isPartOf: {
|
||||||
|
"@type": "Blog",
|
||||||
|
"@id": SITE_URL + "/blog",
|
||||||
|
name: "Jade's Blog",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as WithContext<Thing>;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -66,10 +125,21 @@
|
|||||||
{#if defaultAuthor?.fediverse}
|
{#if defaultAuthor?.fediverse}
|
||||||
<meta name="fediverse:creator" content={defaultAuthor?.fediverse} />
|
<meta name="fediverse:creator" content={defaultAuthor?.fediverse} />
|
||||||
{/if}
|
{/if}
|
||||||
<meta property="og:image" content={calcOgURL(data.post.slug, data.post.date, 630/1200, 1200).toString()} />
|
<meta
|
||||||
<meta property="og:image:width" content={(1200).toString()} />
|
property="og:image"
|
||||||
<meta property="og:image:height" content={(1200 / 2).toString()} />
|
content={calcOgURL(
|
||||||
|
data.post.slug,
|
||||||
|
data.post.date,
|
||||||
|
630 / 1200,
|
||||||
|
1200,
|
||||||
|
).toString()}
|
||||||
|
/>
|
||||||
|
<meta property="og:image:width" content="1200" />
|
||||||
|
<meta property="og:image:height" content="630" />
|
||||||
<meta property="og:image:type" content="image/png" />
|
<meta property="og:image:type" content="image/png" />
|
||||||
|
{@html `<script type="application/ld+json">${
|
||||||
|
JSON.stringify(jsonLd) + "<"
|
||||||
|
}/script>`}
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<SvelteSeo
|
<SvelteSeo
|
||||||
@@ -81,11 +151,16 @@
|
|||||||
// site: "@primalmovement",
|
// site: "@primalmovement",
|
||||||
title: data.post.title,
|
title: data.post.title,
|
||||||
description: data.post.description,
|
description: data.post.description,
|
||||||
image: calcOgURL(data.post.slug, data.post.date, 630/1200, 1200).toString()
|
image: calcOgURL(
|
||||||
|
data.post.slug,
|
||||||
|
data.post.date,
|
||||||
|
630 / 1200,
|
||||||
|
1200,
|
||||||
|
).toString(),
|
||||||
}}
|
}}
|
||||||
openGraph={{
|
openGraph={{
|
||||||
title: data.post.title,
|
title: data.post.title,
|
||||||
description: data.post.description
|
description: data.post.description,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -96,8 +171,14 @@
|
|||||||
>Published on <time class="dt-published" datetime={data.post.date}
|
>Published on <time class="dt-published" datetime={data.post.date}
|
||||||
>{new Date(data.post.date).toLocaleDateString()}</time
|
>{new Date(data.post.date).toLocaleDateString()}</time
|
||||||
></a
|
></a
|
||||||
> <span
|
>
|
||||||
>by <a class="p-author h-card" href={defaultAuthor.url}
|
<span class="author p-author h-card vcard">
|
||||||
|
by <img
|
||||||
|
loading="lazy"
|
||||||
|
style="display: none;"
|
||||||
|
src={defaultAuthor.image}
|
||||||
|
class="avatar avatar-96 photo u-photo"
|
||||||
|
/><a class="u-url url fn n p-name" href={defaultAuthor.url}
|
||||||
>{defaultAuthor.name}</a
|
>{defaultAuthor.name}</a
|
||||||
></span
|
></span
|
||||||
>
|
>
|
||||||
|
|||||||
Generated
+3
@@ -219,6 +219,9 @@ importers:
|
|||||||
rollup-plugin-visualizer:
|
rollup-plugin-visualizer:
|
||||||
specifier: ^5.12.0
|
specifier: ^5.12.0
|
||||||
version: 5.12.0(rollup@4.18.0)
|
version: 5.12.0(rollup@4.18.0)
|
||||||
|
schema-dts:
|
||||||
|
specifier: ^1.1.2
|
||||||
|
version: 1.1.2(typescript@5.4.5)
|
||||||
sharp:
|
sharp:
|
||||||
specifier: ^0.33.4
|
specifier: ^0.33.4
|
||||||
version: 0.33.4
|
version: 0.33.4
|
||||||
|
|||||||
Reference in New Issue
Block a user