Skip to content

Commit

Permalink
feat: Add trailing slash for internal links for percy to not create n…
Browse files Browse the repository at this point in the history
…ew snapshots (#568)

* feat: Add trailing slash for internal links for percy to not create new snapshots

* fix: fix linting errors
  • Loading branch information
pghorpade authored Jul 19, 2024
1 parent 8c2b9d3 commit 4c8e2d1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib-components/SmartLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export default {
isRelative() {
return !!isRelativeLink(this.to)
},
parsedTo() {
if (this.isRelative && !this.isDownload && !this.parsedTarget) {
if (this.to !== '/' && !this.to.endsWith('/') && !this.to.includes('q=') && !this.to.includes('&filters='))
return `${this.to}/`
return this.to
}
return this.to
}
},
}
</script>
Expand All @@ -35,7 +45,7 @@ export default {
<router-link
v-if="isRelative && !isDownload && !parsedTarget"
class="smart-link is-router-link"
:to="to"
:to="parsedTo"
>
<slot />
</router-link>
Expand Down

1 comment on commit 4c8e2d1

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.