Skip to content

Commit

Permalink
fix: adapt link component to local routes (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosirera committed Oct 21, 2020
1 parent b429351 commit 0bb5ac5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
16 changes: 15 additions & 1 deletion components/global/TheLink.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<a class="link" target="_blank" :href="url">
<a class="link cursor-pointer" @click="goToUrl">
<slot />
</a>
</template>
Expand All @@ -12,6 +12,20 @@ export default {
type: String,
required: true,
},
isLocalRoute: {
type: Boolean,
default: false,
},
},
methods: {
goToUrl() {
if (this.isLocalRoute) {
this.$router.push(this.url)
return
}
window.open(this.url, '_blank')
},
},
}
</script>
Expand Down
4 changes: 3 additions & 1 deletion pages/about/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
</p>
<p>
<!-- TODO: add link to blog -->
De vez en cuando escribo artículos en mi blog, hago directos en
De vez en cuando escribo artículos en mi
<TheLink :is-local-route="true" url="/blog">blog</TheLink>, hago directos
en
<TheLink url="https://twitch.tv/pablosirera">Twitch</TheLink> aprendiendo
en vivo o subo vídeos a
<TheLink url="https://youtube.com/psirera4?sub_confirmation=1">
Expand Down
1 change: 0 additions & 1 deletion pages/blog/_slug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default {
return {
title: `${this.doc.title} | Pablo Sirera 👨🏼‍💻`,
meta: [
// TODO: improve descriptions
{
hid: 'description',
name: 'description',
Expand Down

0 comments on commit 0bb5ac5

Please sign in to comment.