Related Content

The instructions in this guide will teach you how to display content related to a category, showing the title and preview text.

Please note: Related content in Neto by Maropost requires a relation on both sides of the pages. So if you want "Page A" to appear as related content on "Page B", make sure that in the Related content section in the Neto control panel, "Page A" has "Page B" in this section, and "Page B" has "Page A".

Wireframe

Related Content Category


Preparation Checklist

Before you start this tweak, it's a good idea to run through our preparation checklist below:

  • Read through the Getting Started to get a better sense of how the control panel, Database and Front End store interact.
  • Learn our recommended Simple Workflow. This makes the implementation process as easy as possible.
  • Create a new Staging Theme for this tweak. This allows you to preview any changes before they are visible to live customers.
  • The code snippet in this tweak doc uses Bootstrap 3, you may need to alter this code depending on what version of Bootstrap your theme is using. You can find out what version your theme is using here.

Coding Instructions

Step 1: Add related content to a category

In the control panel, navigate to Products > Product Categories and open the category you wish to add related content to. Then, navigate to the Related Categories section, and add the page you want to appear using the drop down boxes.

Step 2: Open the category template

The category template can be found here /httpdocs/assets/themes/[THEME-NAME]/templates/cms/category.template.html.

Step 3: Add the code into the template

Paste the following code into the template after the closing [%/THUMB_LIST%] tag.

[%list type:'content' filter:'related_content=[@content_id@]' limit:'99'%]
    [%param *header%]
        <h3>[@total_items@] Related Content Found</h3>
    [%/param%]
    [%param *body%]
        <div class="row">
            <div class="col-xs-12 col-sm-3">
                <a href="[@url@]"><img class="img-responsive" src="[%asset_url type:'content' id:'[@content_id@]' default:'//cdn.neto.com.au/assets/neto-cdn/images/default_product.gif'/%]"></a>
            </div>
            <div class="col-xs-12 col-sm-9">
                <h4>[@content_name@]</h4>
                <p>[@content_short_description1@]</p>
                <p><a href="[@url@]">Read more</a></p>
            </div>
        </div>
    [%/param%]
[%/list%]

Was this article useful?

Be notified when this page is updated. Optional.