Skip to content

Commit

Permalink
fix: post relative URL
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Dec 19, 2024
1 parent 61ebf9a commit bb7ab95
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/entry/layouts/post/IndexLayout.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
import { getRelativeLocaleUrl } from 'astro:i18n';
import type { SupportedLocale } from '@/types';
import DefaultLayout from '../default';
Expand Down Expand Up @@ -85,7 +87,7 @@ const posts = (await resolvePosts(locale)).sort((a, b) => b.data.pubDate.valueOf
{
posts.map((post) => (
<li>
<a href={`${locale !== 'en' ? '/' + locale : ''}/posts/${post.slug}/`}>
<a href={getRelativeLocaleUrl(locale, `/posts/${post.slug}/`)}>
<img width={720} height={360} src={post.data.heroImage} alt="" />
<h4 class="title">{post.data.title}</h4>
<p class="date">
Expand Down

0 comments on commit bb7ab95

Please sign in to comment.