lighthouse fixes

This commit is contained in:
2026-02-10 22:37:29 -05:00
parent 26a8c97841
commit 07d8787972
785 changed files with 166486 additions and 77 deletions

View File

@@ -3,11 +3,28 @@ import BlogLayout from "../../layouts/BlogLayout.astro";
import BlogPostCard from "../../components/BlogPostCard.astro";
import { readContentCache } from "../../lib/content/cache";
import { wordpressCategories, wordpressPages, wordpressPosts } from "../../lib/content/selectors";
import { getPublicConfig } from "../../lib/config";
const cache = await readContentCache();
const categories = wordpressCategories(cache);
const posts = wordpressPosts(cache);
const pages = wordpressPages(cache);
const cfg = getPublicConfig();
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
const blogJsonLd = {
"@context": "https://schema.org",
"@type": "Blog",
name: "SanthoshJ Blog",
url: `${siteUrl}/blog`,
blogPost: posts.slice(0, 20).map((post) => ({
"@type": "BlogPosting",
headline: post.title,
url: `${siteUrl}/blog/post/${post.slug}`,
datePublished: post.publishedAt,
})),
};
---
<BlogLayout
@@ -16,6 +33,7 @@ const pages = wordpressPages(cache);
canonicalPath="/blog"
categories={categories}
>
<script type="application/ld+json" set:html={JSON.stringify(blogJsonLd)} />
<section class="section">
<div class="section-header">
<h2>Latest posts</h2>

View File

@@ -2,6 +2,7 @@
import BlogLayout from "../../../layouts/BlogLayout.astro";
import { readContentCache } from "../../../lib/content/cache";
import { wordpressCategories, wordpressPostBySlug, wordpressPosts } from "../../../lib/content/selectors";
import { getPublicConfig } from "../../../lib/config";
export async function getStaticPaths() {
const cache = await readContentCache();
@@ -21,6 +22,32 @@ if (!post) {
}
const metaDescription = (post.excerpt || "").slice(0, 160);
const cfg = getPublicConfig();
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
const jsonLd = {
"@context": "https://schema.org",
"@type": "BlogPosting",
headline: post.title,
description: metaDescription || "Blog post",
image: post.featuredImageUrl || undefined,
datePublished: post.publishedAt,
dateModified: post.updatedAt,
mainEntityOfPage: {
"@type": "WebPage",
"@id": `${siteUrl}/blog/post/${post.slug}`,
},
author: {
"@type": "Person",
name: "SanthoshJ",
url: `${siteUrl}/`,
},
publisher: {
"@type": "Person",
name: "SanthoshJ",
url: `${siteUrl}/`,
},
};
---
<BlogLayout
@@ -30,6 +57,7 @@ const metaDescription = (post.excerpt || "").slice(0, 160);
categories={categories}
ogImageUrl={post.featuredImageUrl}
>
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
<section class="section">
<div class="section-header">
<h2 style="margin: 0;">{post.title}</h2>