Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/.vuepress/theme/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@
<p>{{ feature.details }}</p>
<div v-if="feature.actions && feature.actions.length" class="actions">
<template v-for="(action, index) in feature.actions">
<router-link :to="action.link" class="action-button">{{
<a
v-if="isExternal(action.link)"
:href="action.link"
class="action-button"
target="_blank"
rel="noopener noreferrer"
>{{ action.text }}</a>
<router-link v-else :to="action.link" class="action-button">{{
action.text
}}</router-link>
</template>
Expand Down Expand Up @@ -67,6 +74,16 @@ export default {
text: this.data.actionText
}
}
},

methods: {
// only treat as external when link is clearly a full URL
// relative paths still use router link
isExternal(link) {
if (typeof link !== 'string') return false
const trimmed = link.trim()
return trimmed.startsWith('http://') || trimmed.startsWith('https://')
}
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ features:
details: Get your randomness or chain information directly by sending HTTP `GET` requests to the drand JSON HTTP API.
actions:
- text: API docs
link: /developer/http-api
link: https://docs.drand.love/dev-guide/developer/http-api
- title: Client libraries
details: Use drand client libraries to easily consume randomness from your applications, over HTTP, gRPC or libp2p PubSub.
actions:
Expand Down