Skip to content

Commit

Permalink
fix: improve language handling in blog pages
Browse files Browse the repository at this point in the history
  • Loading branch information
charlottewiltshire0 committed Jan 12, 2025
1 parent 939822b commit b39176d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/(root)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export async function generateMetadata(props: {
const postData = post[0];

return {
title: postData.title ?? "Untitled Post",
description: postData.excerpt ?? "No description provided.",
title: postData.title.value ?? "Untitled Post",
description: postData.excerpt.value ?? "No description provided.",
openGraph: {
title: postData.title,
description: postData.excerpt,
title: postData.title.value,
description: postData.excerpt.value,
images: postData.imageUrl ? [{ url: postData.imageUrl }] : [],
url: `https://www.redotengine.org//blog/${slug}`,
type: "article",
Expand All @@ -47,8 +47,8 @@ export async function generateMetadata(props: {
},
twitter: {
card: "summary_large_image",
title: postData.title,
description: postData.excerpt,
title: postData.title.value,
description: postData.excerpt.value,
images: postData.imageUrl ? [postData.imageUrl] : [],
},
};
Expand Down
3 changes: 2 additions & 1 deletion app/(root)/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getUsedTags, getLatestArticle, getPosts } from "@/lib/blog";
import BlogClient from "@/components/sections/blog/BlogClient";
import type { Metadata } from "next";
import { getLanguage } from "@/actions/language";

export const metadata: Metadata = {
title: "Blog",
Expand All @@ -14,7 +15,7 @@ export default async function Blog() {
const search = searchParams.get("search") ?? "";

const posts = await getPosts(selectedTag, search);
const latestBlog = await getLatestArticle();
const latestBlog = await getLatestArticle(await getLanguage());

return <BlogClient posts={posts} latestBlog={latestBlog} tags={tags} />;
}

0 comments on commit b39176d

Please sign in to comment.