Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
fix links
Browse files Browse the repository at this point in the history
  • Loading branch information
hlassiege committed Nov 12, 2023
1 parent 16c6326 commit 6911170
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/BlogCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<a
v-for="tag in tags"
:key="tag"
:href="currentLang + '/blog?tag=' + tag"
:href="prefixLinkToTag + 'blog?tag=' + tag"
:aria-label="`More about ${tag}`"
class="m-1 leading-loose text-slate-500 border border-current lowercase px-2 rounded font-medium"
@click.prevent="$emit('changeCurrentTag', tag)"
Expand All @@ -60,6 +60,7 @@ const props = defineProps({
date: {
type: String,
required: false,
default: "",
},
path: {
type: String,
Expand All @@ -68,6 +69,7 @@ const props = defineProps({
img: {
type: String,
required: false,
default: "",
},
lang: {
type: String,
Expand All @@ -77,10 +79,12 @@ const props = defineProps({
tags: {
type: Array,
required: false,
default: () => [],
},
currentTag: {
type: String,
required: false,
default: "",
},
currentLang: {
type: String,
Expand All @@ -101,6 +105,12 @@ function formatDate(date: string) {
});
}
const prefixLinkToTag = computed(() => {
if (!props.currentTag) return "";
if (props.currentLang === "en") return `/blog?tag=${props.currentTag}`;
return `/${props.currentLang}/blog?tag=${props.currentTag}`;
});
const isDisplayed = computed(() => {
const tagsIncludeCurrentTag =
!props.currentTag || props.tags?.includes(props.currentTag);
Expand Down

0 comments on commit 6911170

Please sign in to comment.