Repository navigation
Track inline links to CTA destinations #5860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bbe1cf8
Track inline markdown links to CTA destinations
Yndira-E e4d7760
Add CtaLink for inline CTA links in .vue pages
Yndira-E ca094cd
Render CtaImage through CtaLink
Yndira-E b959445
Catch every URL variant of a CTA destination in the CtaCustom guards
Yndira-E a79eea4
Count a hash link as its own destination
Yndira-E f824187
Let CTA buttons and links add URL parameters to their destination
Yndira-E 4cf4d89
Name the registry test for both checks it runs
Yndira-E 8372f47
Keep repeated query parameters on CTA links
Yndira-E 40b3f84
Match http:// links to CTA destinations too
Yndira-E 6a1d966
Handle uppercase schemes and built-in property names in CTA links
Yndira-E 512d1df
Retrigger CI
Yndira-E b0844ad
Merge remote-tracking branch 'origin/main' into feat/track-inline-cta…
Yndira-E File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <script setup lang="ts"> | ||
| import UiProseA from '@nuxt/ui/components/prose/A.vue' | ||
| import { CTA_DESTINATIONS, withCtaQuery, type CtaQuery } from '../lib/cta-destinations' | ||
| import { useCapture } from '../composables/useCapture' | ||
|
|
||
| const props = withDefaults(defineProps<{ | ||
| destination: keyof typeof CTA_DESTINATIONS | ||
| position: string | ||
| variant?: 'text' | 'image' | ||
| query?: CtaQuery | ||
| target?: string | ||
| prose?: boolean | ||
| }>(), { variant: 'text' }) | ||
|
|
||
| const dest = computed(() => { | ||
| const match = CTA_DESTINATIONS[props.destination] | ||
| if (!match) throw new Error(`CtaLink: invalid destination "${props.destination}" - must be one of: ${Object.keys(CTA_DESTINATIONS).join(', ')}`) | ||
| return match | ||
| }) | ||
| const linkHref = computed(() => withCtaQuery(dest.value.href, props.query)) | ||
| const capture = useCapture() | ||
|
|
||
| function onClick () { | ||
| capture(dest.value.event, { position: props.position, variant: props.variant }) | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <UiProseA v-if="prose" :href="linkHref" :target="target" @click="onClick"> | ||
| <slot /> | ||
| </UiProseA> | ||
| <ULink v-else :href="linkHref" :target="target" raw @click="onClick"> | ||
| <slot /> | ||
| </ULink> | ||
| </template> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.