Fix permalinks with trailing slash in paginations

This commit is contained in:
prototypa
2022-11-04 02:40:07 +01:00
parent 3f59cdfda2
commit e50a5668a1
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
---
import { Icon } from 'astro-icon';
import { getPermalink } from '~/utils/permalinks';
const { prevUrl, nextUrl, prevText = 'Newer posts', nextText = 'Older posts' } = Astro.props;
---
@ -8,7 +9,7 @@ const { prevUrl, nextUrl, prevText = 'Newer posts', nextText = 'Older posts' } =
<div class="container flex">
<div class="flex flex-row mx-auto container justify-between">
<a
href={prevUrl}
href={getPermalink(prevUrl, "raw")}
class={`btn px-2 font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white shadow-none mr-2
${!prevUrl ? 'invisible' : ''}`}
>
@ -18,7 +19,7 @@ const { prevUrl, nextUrl, prevText = 'Newer posts', nextText = 'Older posts' } =
</div>
</a>
<a
href={nextUrl}
href={getPermalink(nextUrl, "raw")}
class={`btn px-2 font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white shadow-none ${
!nextUrl ? 'invisible' : ''
}`}