I've encountered an issue with the related posts component on my Svelte website. While it functions correctly, there is a problem with duplicate articles showing up in the block. For example, if two articles contain three identical tags each, those articles will appear multiple times in the related posts section of each article.
<script>
import { getMarkdownPosts } from '$lib/utils/getPosts'
let posts = getMarkdownPosts()
export let currentPostTitle, currentPostTags
</script>
{#await posts}
Loading...
{:then posts}
Related posts
<ul>
{#each posts as {slug, meta: {title, tags, published}}}
{#if published}
{#if currentPostTitle != title}
{#each tags as tag}
<!-- {#if index === 1 } -->
{#if currentPostTags.includes(tag)}
<li><a href="/blog/{slug}"><h4>{title}</h4></a></li>
{/if}
<!-- {/if} -->
{/each}
{/if}
{/if}
{/each}
</ul>
{/await}
Is there a way to modify this code so that this duplication issue can be resolved?