Unless statement - settings font variable in Dawn theme

Unless statement - settings font variable in Dawn theme

mcclardhabitat
Visitor
2 0 0

 

{%- unless settings.type_header_font.system? and settings.type_body_font.system? -%}
    <link rel="preconnect" href="https://fonts.shopifycdn.com" crossorigin>
{%- endunless -%}

 

 

Can someone please describe what's happening in this statement? I know it's looking at a theme setting variable, but there are some things I don't understand.

 

1. No matter what I set the font to, system or Shopify font, the statement runs true.

2. Is the question mark on the end turning the value into a boolean?

3. What does `system` describe? It looks like an object key, but I can't tell what it's set to.

 

Thank you

Reply 1 (1)

iDoThemes
Trailblazer
207 43 94

Hi there, I believe that is referring to this:

system.png

 

If you aren't using a system font for both of these, then it will add the prefetch link to the document in order to fetch the fonts faster. You'll need to set both type_header_font and type_body_font to a system font if you don't want this to resolve.

 

Developer of Liquify Chrome Extension -- Enhance the Shopify Theme Code Editor
.




Theme Developer -- Drop me a line