upgrade deps to latest & migrate to astro:assets Image
- bump astro 5→6, @astrojs/mdx 4→6, astro-seo 0.8→1.1, sharp 0.33→0.35, plus minor updates - move local images from public/ to src/assets/ - replace <img> with <Image> from astro:assets (inferSize for remote URLs) - content schema uses image() helper for local covers - eager-load above-the-fold images (article covers, hero avatars)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import type { ImageMetadata } from "astro:assets";
|
||||
|
||||
export const SITE_URL = "https://mariosant.dev";
|
||||
export const TWITTER_HANDLE = "@marios_ant";
|
||||
@@ -42,6 +43,9 @@ export const deriveDescription = (body: string, max = 155): string => {
|
||||
|
||||
type ArticleEntry = CollectionEntry<"articles">;
|
||||
|
||||
export const imageSrc = (img: ImageMetadata | string): string =>
|
||||
typeof img === "string" ? img : img.src;
|
||||
|
||||
export const personJsonLd = (): string =>
|
||||
JSON.stringify({
|
||||
"@context": "https://schema.org",
|
||||
@@ -62,7 +66,7 @@ export const articleJsonLd = (entry: ArticleEntry): string => {
|
||||
"@type": "Article",
|
||||
headline: entry.data.title,
|
||||
description,
|
||||
image: entry.data.coverImage.url,
|
||||
image: imageSrc(entry.data.coverImage.url),
|
||||
datePublished: entry.data.date.toISOString(),
|
||||
author: {
|
||||
"@id": PERSON_ID,
|
||||
|
||||
Reference in New Issue
Block a user