lighthouse fixes
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from "../lib/content/selectors";
|
||||
import { readFeaturedVideoIds } from "../lib/content/curation";
|
||||
import { LINKS } from "../lib/links";
|
||||
import { getPublicConfig } from "../lib/config";
|
||||
|
||||
const cache = await readContentCache();
|
||||
const featuredIds = await readFeaturedVideoIds();
|
||||
@@ -36,13 +37,35 @@ const options = {
|
||||
};
|
||||
|
||||
const newYorkTime = new Date(cache.generatedAt).toLocaleString('en-US', options);
|
||||
|
||||
const cfg = getPublicConfig();
|
||||
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
|
||||
|
||||
const homeJsonLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@graph": [
|
||||
{
|
||||
"@type": "WebSite",
|
||||
name: "SanthoshJ",
|
||||
url: `${siteUrl}/`,
|
||||
inLanguage: "en-US",
|
||||
},
|
||||
{
|
||||
"@type": "Person",
|
||||
name: "SanthoshJ",
|
||||
url: `${siteUrl}/`,
|
||||
sameAs: [LINKS.youtubeChannel, LINKS.instagramProfile, LINKS.podcast],
|
||||
},
|
||||
],
|
||||
};
|
||||
---
|
||||
|
||||
<BaseLayout
|
||||
title="SanthoshJ | Tech, streaming, movies, travel"
|
||||
description="SanthoshJ shares tech, gaming streams, movie recommendations, and travel stories—plus the Irregular Mind podcast. Explore the newest videos and episodes."
|
||||
description="SanthoshJ shares tech, gaming streams, movie recommendations, and travel stories-plus the Irregular Mind podcast. Explore the newest videos and episodes."
|
||||
canonicalPath="/"
|
||||
>
|
||||
<script type="application/ld+json" set:html={JSON.stringify(homeJsonLd)} />
|
||||
<section class="hero">
|
||||
<div>
|
||||
<h1>Tech, gaming, movies & travel — videos + podcast by SanthoshJ</h1>
|
||||
|
||||
@@ -4,11 +4,36 @@ import ContentCard from "../components/ContentCard.astro";
|
||||
import MediaModal from "../components/MediaModal.astro";
|
||||
import { readContentCache } from "../lib/content/cache";
|
||||
import { podcastEpisodes } from "../lib/content/selectors";
|
||||
import { getPublicConfig } from "../lib/config";
|
||||
|
||||
const cache = await readContentCache();
|
||||
const episodes = podcastEpisodes(cache).sort(
|
||||
(a, b) => Date.parse(b.publishedAt) - Date.parse(a.publishedAt),
|
||||
);
|
||||
|
||||
const cfg = getPublicConfig();
|
||||
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
|
||||
const canonicalUrl = `${siteUrl}/podcast`;
|
||||
|
||||
const podcastJsonLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "CollectionPage",
|
||||
name: "Podcast | Irregular Mind",
|
||||
url: canonicalUrl,
|
||||
mainEntity: {
|
||||
"@type": "ItemList",
|
||||
itemListElement: episodes.slice(0, 20).map((episode, index) => ({
|
||||
"@type": "ListItem",
|
||||
position: index + 1,
|
||||
url: `${siteUrl}/podcast/${encodeURIComponent(episode.id)}`,
|
||||
item: {
|
||||
"@type": "PodcastEpisode",
|
||||
name: episode.title,
|
||||
datePublished: episode.publishedAt,
|
||||
},
|
||||
})),
|
||||
},
|
||||
};
|
||||
---
|
||||
|
||||
<BaseLayout
|
||||
@@ -16,6 +41,7 @@ const episodes = podcastEpisodes(cache).sort(
|
||||
description="Episodes from the Irregular Mind podcast."
|
||||
canonicalPath="/podcast"
|
||||
>
|
||||
<script type="application/ld+json" set:html={JSON.stringify(podcastJsonLd)} />
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>Irregular Mind</h2>
|
||||
|
||||
@@ -4,11 +4,36 @@ import ContentCard from "../components/ContentCard.astro";
|
||||
import MediaModal from "../components/MediaModal.astro";
|
||||
import { readContentCache } from "../lib/content/cache";
|
||||
import { youtubeVideos } from "../lib/content/selectors";
|
||||
import { getPublicConfig } from "../lib/config";
|
||||
|
||||
const cache = await readContentCache();
|
||||
const videos = youtubeVideos(cache).sort(
|
||||
(a, b) => Date.parse(b.publishedAt) - Date.parse(a.publishedAt),
|
||||
);
|
||||
|
||||
const cfg = getPublicConfig();
|
||||
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
|
||||
const canonicalUrl = `${siteUrl}/videos`;
|
||||
|
||||
const videosJsonLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "CollectionPage",
|
||||
name: "Videos | SanthoshJ",
|
||||
url: canonicalUrl,
|
||||
mainEntity: {
|
||||
"@type": "ItemList",
|
||||
itemListElement: videos.slice(0, 20).map((video, index) => ({
|
||||
"@type": "ListItem",
|
||||
position: index + 1,
|
||||
url: `${siteUrl}/videos/${encodeURIComponent(video.id)}`,
|
||||
item: {
|
||||
"@type": "VideoObject",
|
||||
name: video.title,
|
||||
uploadDate: video.publishedAt,
|
||||
},
|
||||
})),
|
||||
},
|
||||
};
|
||||
---
|
||||
|
||||
<BaseLayout
|
||||
@@ -16,6 +41,7 @@ const videos = youtubeVideos(cache).sort(
|
||||
description="Latest and featured YouTube videos."
|
||||
canonicalPath="/videos"
|
||||
>
|
||||
<script type="application/ld+json" set:html={JSON.stringify(videosJsonLd)} />
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>Videos</h2>
|
||||
|
||||
Reference in New Issue
Block a user