Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions blog-cloudflare/src/layouts/Base.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { getMenu, getEmDashCollection } from "emdash";
import { getMenu, getEmDashCollection, getSiteSettings } from "emdash";
import {
WidgetArea,
EmDashHead,
Expand Down Expand Up @@ -36,7 +36,9 @@ const {
author,
content,
} = Astro.props;
const siteTitle = "My Blog";
const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteTagline = settings?.tagline || "";
// If title already includes site title (from getSeoMeta), use as-is
const fullTitle = title.includes(siteTitle) ? title : `${title} — ${siteTitle}`;

Expand Down Expand Up @@ -136,7 +138,7 @@ const isLoggedIn = !!Astro.locals.user;
<div class="footer-grid">
<div class="footer-brand">
<a href="/" class="footer-logo">{siteTitle}</a>
<p class="footer-tagline">Thoughts, stories, and ideas.</p>
<p class="footer-tagline">{siteTagline}</p>
</div>
<div class="footer-nav">
<h4 class="footer-heading">Navigate</h4>
Expand Down
8 changes: 6 additions & 2 deletions blog-cloudflare/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
import { getEmDashCollection, getEntryTerms } from "emdash";
import { getEmDashCollection, getEntryTerms, getSiteSettings } from "emdash";
import { Image } from "emdash/ui";
import Base from "../layouts/Base.astro";
import PostCard from "../components/PostCard.astro";
import { getReadingTime } from "../utils/reading-time";

const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteTagline = settings?.tagline || "";

const { entries: posts, cacheHint } = await getEmDashCollection("posts");

Astro.cache.set(cacheHint);
Expand Down Expand Up @@ -58,7 +62,7 @@ function formatDate(date: Date | null | undefined) {
}
---

<Base title="My Blog" description="Welcome to my blog">
<Base title={siteTitle} description={siteTagline}>
{
posts.length === 0 ? (
<section class="empty-state">
Expand Down
6 changes: 5 additions & 1 deletion blog-cloudflare/src/pages/posts/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getEmDashCollection,
getEntryTerms,
getSeoMeta,
getSiteSettings,
} from "emdash";
import {
Image,
Expand Down Expand Up @@ -53,9 +54,12 @@ function getImageUrl(img: unknown): string | undefined {
}
const featuredImageUrl = getImageUrl(post.data.featured_image);

const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";

// Generate SEO meta from content
const seo = getSeoMeta(post, {
siteTitle: "My Blog",
siteTitle,
siteUrl: Astro.url.origin,
path: `/posts/${slug}`,
defaultOgImage: featuredImageUrl,
Expand Down
8 changes: 4 additions & 4 deletions blog-cloudflare/src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { APIRoute } from "astro";
import { getEmDashCollection } from "emdash";

const siteTitle = "My Blog";
const siteDescription = "A blog about software, design, and the occasional stray thought.";
import { getEmDashCollection, getSiteSettings } from "emdash";

export const GET: APIRoute = async ({ site, url }) => {
const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteDescription = settings?.tagline || "";
const siteUrl = site?.toString() || url.origin;

const { entries: posts } = await getEmDashCollection("posts", {
Expand Down
8 changes: 5 additions & 3 deletions blog/src/layouts/Base.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { getMenu, getEmDashCollection } from "emdash";
import { getMenu, getEmDashCollection, getSiteSettings } from "emdash";
import {
WidgetArea,
EmDashHead,
Expand Down Expand Up @@ -36,7 +36,9 @@ const {
author,
content,
} = Astro.props;
const siteTitle = "My Blog";
const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteTagline = settings?.tagline || "";
// If title already includes site title (from getSeoMeta), use as-is
const fullTitle = title.includes(siteTitle) ? title : `${title} — ${siteTitle}`;

Expand Down Expand Up @@ -136,7 +138,7 @@ const isLoggedIn = !!Astro.locals.user;
<div class="footer-grid">
<div class="footer-brand">
<a href="/" class="footer-logo">{siteTitle}</a>
<p class="footer-tagline">Thoughts, stories, and ideas.</p>
<p class="footer-tagline">{siteTagline}</p>
</div>
<div class="footer-nav">
<h4 class="footer-heading">Navigate</h4>
Expand Down
8 changes: 6 additions & 2 deletions blog/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
import { getEmDashCollection, getEntryTerms } from "emdash";
import { getEmDashCollection, getEntryTerms, getSiteSettings } from "emdash";
import { Image } from "emdash/ui";
import Base from "../layouts/Base.astro";
import PostCard from "../components/PostCard.astro";
import { getReadingTime } from "../utils/reading-time";

const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteTagline = settings?.tagline || "";

const { entries: posts, cacheHint } = await getEmDashCollection("posts");

Astro.cache.set(cacheHint);
Expand Down Expand Up @@ -58,7 +62,7 @@ function formatDate(date: Date | null | undefined) {
}
---

<Base title="My Blog" description="Welcome to my blog">
<Base title={siteTitle} description={siteTagline}>
{
posts.length === 0 ? (
<section class="empty-state">
Expand Down
6 changes: 5 additions & 1 deletion blog/src/pages/posts/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getEmDashCollection,
getEntryTerms,
getSeoMeta,
getSiteSettings,
} from "emdash";
import {
Image,
Expand Down Expand Up @@ -53,9 +54,12 @@ function getImageUrl(img: unknown): string | undefined {
}
const featuredImageUrl = getImageUrl(post.data.featured_image);

const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";

// Generate SEO meta from content
const seo = getSeoMeta(post, {
siteTitle: "My Blog",
siteTitle,
siteUrl: Astro.url.origin,
path: `/posts/${slug}`,
defaultOgImage: featuredImageUrl,
Expand Down
8 changes: 4 additions & 4 deletions blog/src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { APIRoute } from "astro";
import { getEmDashCollection } from "emdash";

const siteTitle = "My Blog";
const siteDescription = "A blog about software, design, and the occasional stray thought.";
import { getEmDashCollection, getSiteSettings } from "emdash";

export const GET: APIRoute = async ({ site, url }) => {
const settings = await getSiteSettings();
const siteTitle = settings?.title || "My Blog";
const siteDescription = settings?.tagline || "";
const siteUrl = site?.toString() || url.origin;

const { entries: posts } = await getEmDashCollection("posts", {
Expand Down