Skip to main content
All CollectionsAdvanced Guides
Interlink pages with each other
Interlink pages with each other

You can easily add internal links between your created pages to improve SEO and help your users navigate.

Jonas Lindemann avatar
Written by Jonas Lindemann
Updated over 3 weeks ago

LPagery provides a powerful feature to interlink your generated pages with ease using the [lpagery_link] shortcode. This shortcode allows you to create dynamic links between your pages, improving navigation and user experience. Each link created with the shortcode automatically includes the class lpagery_link_anchor.

This feature is available for the LPagery Extended plan and above.
Click here to purchase LPagery Pro ->


Linking Pages by Position:

[lpagery_link position=""]

You can link pages based on their position in the source file, which can help users navigate between related pages.

Example Shortcode:

[lpagery_link position="NEXT" title="Next Page" circle=true target="_blank"]

Parameters

  • position: Defines which page to link to based on its position in the source file.

    • FIRST: Links to the first page created.

    • LAST: Links to the last page created.

    • NEXT: Links to the next page in the order of creation.

    • PREV: Links to the previous page in the order of creation.

  • circle: Enables looping through pages.

    • true or yes: If enabled, the link will loop back to the first page after the last page (or vice versa).

  • title: Defines the text used for the link. If not set, the title of the linked page is used. Placeholders can be inserted here as well.

    • Example: "Next Page"

  • target: Specifies how the link opens.

    • _blank: Opens the link in a new tab.

    • _self: Opens the link in the same tab.

    • _parent: Opens the link in the parent frame.

    • _top: Opens the link in the full body of the window.

Example Usage:

[lpagery_link position="NEXT" title="Next" circle=true target="_blank"]

This creates a link to the next page in your source file, looping back to the first page after reaching the last one.


Linking Pages by Slug

[lpagery_link slug=""]

You can also link pages by specifying the page slug, which allows you to create links based on custom data or page names.

Example Data from the Source File

city

link_to

link_title

Hamburg

berlin

Page of Berlin

Berlin

hamburg

Page of Hamburg

Munich

berlin

Page of Berlin

Example Shortcode in Template Page

[lpagery_link slug="{link_to}" title="{link_title}"]

In this example, {link_to} will dynamically pull the slug from the source file and {link_title} will set the displayed link text.


Results on the Generated Pages

  1. On the Hamburg and Munich pages:

    [lpagery_link slug="berlin" title="Page of Berlin"]

    This will result in:

    <a class="lpagery_link_anchor" href="https://yoursite.example/berlin/" target="_self">Page of Berlin</a>
  2. On the Berlin page:

    [lpagery_link slug="hamburg" title="Page of Hamburg"]

    This will result in:

    <a class="lpagery_link_anchor" href="https://yoursite.example/hamburg/" target="_self">Page of Hamburg</a>

You can also hardcode slugs directly, but ensure the resulting slug matches an existing page on your site.


Best Practices for Interlinking

  • Use placeholders: Using placeholders like {link_to} and {link_title} allows for greater flexibility, as the links are dynamically generated based on the data in your source file.

  • Ensure slugs exist: Always double-check that the slug you're linking to corresponds to a valid page slug on your site, as invalid slugs will result in broken links.

  • Looping Navigation: Using the circle parameter ensures users can always navigate back to the first page after reaching the last one, or vice versa, creating a seamless browsing experience.

By leveraging the [lpagery_link] shortcode, you can easily build a network of interconnected pages that guide users through your content in a dynamic and structured way.

Did this answer your question?