Skip to content

Commit

Permalink
hide empty tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveed committed Dec 9, 2024
1 parent 3b516d4 commit f73066f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/pages/stores/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const { slug } = Astro.params;
const stores = await getCollection("stores");
const store = stores.find((store: Store) => store.data.slug == slug);
console.log({ store, urls: store?.data?.URLS });
---

<Layout
Expand Down Expand Up @@ -72,16 +71,17 @@ console.log({ store, urls: store?.data?.URLS });
<div class="all-posts-btn-wrapper">
{
store?.data?.URLS.map(url => {
return (
<p class="mb-5 mt-2">
<LinkButton target="_blank" href={url.URL}>
{url.Label}
<svg xmlns="http://www.w3.org/2000/svg">
<path d="m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" />
</svg>
</LinkButton>
</p>
);
if (url.URL && url.Label)
return (
<p class="mb-5 mt-2">
<LinkButton target="_blank" href={url.URL}>
{url.Label}
<svg xmlns="http://www.w3.org/2000/svg">
<path d="m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" />
</svg>
</LinkButton>
</p>
);
})
}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let tags = getUniqueTags(posts);
<Header activeNav="tags" store={store} />
<Main pageTitle="Tags" pageDesc="All the tags used in posts.">
<ul>
{tags.map(({ tag }) => <Tag {tag} size="lg" />)}
{tags.map(({ tag }) => tag && <Tag {tag} size="lg" />)}
</ul>
</Main>
<Footer />
Expand Down

0 comments on commit f73066f

Please sign in to comment.