Harden footer partial against missing config fields to avoid render-time errors

This commit is contained in:
gator 2026-03-10 22:05:22 +00:00
parent d0261367a4
commit 52d126affe

View file

@ -2,17 +2,17 @@
<div class="container footer-grid">
<div>
<a href="/" class="brand brand-footer">
<img src="<%= config.assets.logo %>" alt="<%= config.brand.name %> logo" loading="lazy" />
<span><%= config.brand.name %></span>
<img src="<%= config?.assets?.logo || '' %>" alt="<%= config?.brand?.name || 'AutoTQ' %> logo" loading="lazy" />
<span><%= config?.brand?.name || 'AutoTQ' %></span>
</a>
<p><%= config.brand.tagline %></p>
<p class="legal"><%= config.brand.legalName %></p>
<p><%= config?.brand?.tagline || '' %></p>
<p class="legal"><%= config?.brand?.legalName || '' %></p>
</div>
<div>
<h4>Explore</h4>
<ul class="footer-links">
<% config.nav.forEach(item => { %>
<% (config?.nav || []).forEach(item => { %>
<li><a href="<%= item.href %>"><%= item.label %></a></li>
<% }) %>
</ul>
@ -21,13 +21,13 @@
<div>
<h4>Contact</h4>
<ul class="footer-links">
<li><a href="<%= config.contact.phoneHref %>"><%= config.contact.phoneDisplay %></a></li>
<li><a href="mailto:<%= config.contact.email %>"><%= config.contact.email %></a></li>
<li><%= config.contact.addressLine1 %><br /><%= config.contact.addressLine2 %></li>
<li><a href="<%= config?.contact?.phoneHref || '#' %>"><%= config?.contact?.phoneDisplay || '' %></a></li>
<li><a href="mailto:<%= config?.contact?.email || '' %>"><%= config?.contact?.email || '' %></a></li>
<li><%= config?.contact?.addressLine1 || '' %><br /><%= config?.contact?.addressLine2 || '' %></li>
</ul>
</div>
</div>
<div class="container footer-bottom">
<small>© <%= new Date().getFullYear() %> <%= config.brand.name %>. All rights reserved.</small>
<small>© <%= new Date().getFullYear() %> <%= config?.brand?.name || 'AutoTQ' %>. All rights reserved.</small>
</div>
</footer>