Browse Source

Gracefully handle missing hero_cta_link

Matt Westcott 7 năm trước cách đây
mục cha
commit
45665ab74d
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      bakerydemo/templates/base/home_page.html

+ 6 - 2
bakerydemo/templates/base/home_page.html

@@ -12,9 +12,13 @@
             <div class="col-md-8 col-md-offset-2 home-hero">
                 <h1>{{ page.title }}</h1>
                 <p class="lead">{{ page.hero_text }}</p>
-                <a href="{% pageurl page.hero_cta_link %}" class="hero-cta-link hvr-icon-forward">
+                {% if page.hero_cta_link %}
+                    <a href="{% pageurl page.hero_cta_link %}" class="hero-cta-link hvr-icon-forward">
+                        {{ page.hero_cta }}
+                    </a>
+                {% else %}
                     {{ page.hero_cta }}
-                </a>
+                {% endif %}
             </div>
         </div>
     </div>