Hide breadcrumb on homepage

With the code below, I would like to prevent the breadcrumb from appearing on the homepage (without using CSS to hide it). I am using the code in a partial which is borrowed from this forum.

<span class="breadcrumb">
<a href="/">Home</a>
  {{ template "breadcrumb" dict "currentPage" .Page "id" .File.UniqueID }}
</span>
<!-- templates -->
{{ define "breadcrumb" }}
{{ $page := .currentPage }}
 {{ if $page.Parent }}
 {{ if ne $page.Parent .IsHome }}
    {{ template "breadcrumb" dict "currentPage" $page.Parent }}
  {{ end }}
    {{ if eq .id $page }}
      {{ $page.Title }}
    {{ else }}
      <a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a> <span class="tick">»</span>
    {{ end }}
{{ end }}
{{ end }}

Render breadcrumb if not homepage .IsHome

++ {{ if not .IsHome }}
<span class="breadcrumb">
<a href="/">Home</a>
  {{ template "breadcrumb" dict "currentPage" .Page "id" .File.UniqueID }}
</span>
++ {{ end }}

<!-- templates -->
{{ define "breadcrumb" }}
{{ $page := .currentPage }}
 {{ if $page.Parent }}
 {{ if ne $page.Parent .IsHome }}
    {{ template "breadcrumb" dict "currentPage" $page.Parent }}
  {{ end }}
    {{ if eq .id $page }}
      {{ $page.Title }}
    {{ else }}
      <a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a> <span class="tick">»</span>
    {{ end }}
{{ end }}
{{ end }}

Thanks. That worked!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.