Configuring the Link Preview Template

Getting started

You’ll find the Link Preview Template option under the Internal Link Juicer’s “Settings” section. Let’s explain how to get to everything you’re looking for.

  1. Click on the “Setting” Page

    Once you’re in the Internal Link Juicer Settings page, click on the “Links” tab.

  2. Enable the Link Preview feature

    You can enable and disable this feature using the toggle switch.

  3. Customize the link preview template

    To add additional functionality to your links, you can customize the link preview template.

1. When you want to change the preview structure

The structure can be changed by modifying the template ( Internal Links > Settings > Links )

The template is written in Liquid, a popular open-source template language. It supports a variety of operators, functions, and even includes control flows. You can read more about it here. By default it displays featured image and excerpt of post / term, if you want to change this behavior to show only excerpt, you change the template to this.

The link preview will now display only excerpts.

2. Add additional attributes

By default, you will have featuredImage and excerpt available for use inside the liquid template, to add additional attributes you can make use of the following filters.

  • ilj_post_link_attributes for post
  • ilj_term_link_attributes for term

For instance if you have a acf field which you need to display on link preview instead of excerpt, you can use the following code snippet.

This adds the content of your ACF field to the data attribute data-acf-content. Now, this field value will be accessible in the template as acfContent. Data attributes are directly passed to the template, and you should be mindful of the case conversion that occurs in the data attribute. You can now modify the template to display this acf content

3. Disabling the link preview for a single post id.

The preview will only be disabled when the link has the data-ilj-link-preview attribute, you can remove the attribute if you want to disable it for post id 1 by adding:

If you want to display the preview only for term with term id 1 add:

5. Enable the feature only for page post type.

If you want to enable the feature to appear only for a page post type, add:

6. Enable the feature only for tags

If you want to enable the feature only for tags, where only links pointing to tags taxonomy will have the link preview, add: