Articles on: Configuration

How to override the preview URL?

In certain cases, you might want to display a preview of a different URL than the one actually linked. This can be useful if, for example, you have a middle page that users pass through before visiting a third-party link (similar to the approach used by LinkedIn or Facebook).

To achieve this, you can use the data-linkz-preview-url attribute within your HTML anchor tags. By setting this attribute, you can specify a custom URL for the preview, independent of the hyperlink itself.

Example

Here’s how you can use the data-linkz-preview-url attribute:

<a href="https://your-domain.com/going-external" data-linkz-preview-url="https://example.com/previewed-url">Example hyperlink</a>


In this example:
href="https://your-domain.com/going-external": The actual link where the user will be directed when they click the hyperlink.
data-linkz-preview-url="https://example.com/previewed-url": The URL that will be used to generate the preview.

This setup ensures that users see a preview of https://example.com/previewed-url when hovering over or interacting with the link, even though they will ultimately be directed to https://your-domain.com/going-external.

Use Case

This feature is particularly useful for sites that include a transition page before redirecting users to an external link. It allows you to maintain consistent preview behavior, even when the actual link is different from the content being previewed.

Updated on: 11/08/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!