Skip to content

Commit

Permalink
add other products in category to product template
Browse files Browse the repository at this point in the history
  • Loading branch information
pglevy committed May 3, 2021
1 parent 5ea2360 commit 8348eff
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions _layouts/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ <h1 class="margin-top-0">{{ page.title }}</h1>

<section class="maxw-tablet">
{{ content }}

{% assign related_products = site.products | where: "category", page.category %}
<h2>Other products in {{ page.category }}</h2>
<ul>
{% for product in related_products %}
{% if product.title != page.title %}
<li>
<a href="{{ site.baseurl }}{{ product.url }}">{{ product.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>

</section>

</div>
Expand Down

0 comments on commit 8348eff

Please sign in to comment.