Skip to content

Commit 42020bd

Browse files
committed
fix: Fix relates blog articles section
1 parent 50035eb commit 42020bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/layouts/Post.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import BaseLayout from "./Common.astro";
3+
import { getBlogPosts } from "../content/config";
34
import { type CollectionEntry } from "astro:content";
45
56
type Props = CollectionEntry<"blog">["data"];
@@ -10,8 +11,7 @@ import { getLangFromUrl, useTranslations } from "../i18n/utils";
1011
const currentLang = getLangFromUrl(Astro.url);
1112
const t = useTranslations(currentLang);
1213
13-
import { getCollection } from "astro:content";
14-
const blogEntries = (await getCollection("blog"))
14+
const blogEntries = (await getBlogPosts())
1515
.filter(function (blogEntry) {
1616
return blogEntry.data.tags.some((element: any) => {
1717
return tags.indexOf(element) !== -1;
@@ -111,7 +111,7 @@ const blogEntries = (await getCollection("blog"))
111111
blogEntries.map((post) => (
112112
<article class="lb-blog__item blog-img-zoom">
113113
<div class="thumb">
114-
<a href={`${post.slug.split("/")[1]}`}>
114+
<a href={`/${lang}/blog/${post.blog_slug}`}>
115115
<img src={post.data.image} />
116116
</a>
117117
</div>
@@ -126,7 +126,7 @@ const blogEntries = (await getCollection("blog"))
126126
</span>
127127
</li>
128128
</ul>
129-
<a href="blog-details.html">
129+
<a href={`/${lang}/blog/${post.blog_slug}`}>
130130
<h3 class="lb-blog__title">{post.data.title}</h3>
131131
</a>
132132
</article>

0 commit comments

Comments
 (0)