---
import DefaultPageLayout from '$/layouts/default.astro'

let title = 'All Tags'
let description = 'All the tags used so far...'


const allPosts = await Astro.glob('../blog/*.md');
const tags = [...new Set([].concat.apply([], allPosts.map(post => post.frontmatter.tags)))]
---

<DefaultPageLayout content={{ title, description }}>
    <ul class="tag-list">
     {tags.map((tag) => (
        <li><a class="tag" href={`/tags/${tag}`} title={`View posts tagged under "${tag}"`}>{tag}</a></li>
    ))}
    </ul>
</DefaultPageLayout>

<style>
    .tag-list {
        @apply list-none flex gap-2 flex-wrap
    }
    .tag {
        @apply inline-block text-xl px-4 py-1 rounded-full text-theme-primary bg-theme-dark-primary dark:bg-theme-primary dark:text-theme-dark-primary hover:bg-theme-primary hover:text-theme-dark-primary dark:hover:bg-theme-dark-primary dark:hover:text-theme-primary
    }
</style>
