Metafield link won't render on product page

Short description of issue

metafield link won’t render on product page using theme lorenza

Link to Shopify Store

Reproduction steps

added a metafield for “Fabric Guide PDF” with a link to the file. It refuses to render on pages when I insert the link. Ai assisted me in the custom code

Additional info

added a metafield for “Fabric Guide PDF” with a link to the file. It refuses to render on pages when I insert the link. Ai assisted me in the custom code

What type of topic is this

Troubleshooting

Hi @Andrew_Lim

I’m not sure what the code generated by AI looks like for you; here’s my code for reference only.

{% assign fabric_pdf = product.metafields.custom.fabric_guide_pdf %}
{% if fabric_pdf != blank %}
  <div class="fabric-guide-pdf" style="margin-top: 16px;">
    <a href="{{ fabric_pdf.value | file_url }}" target="_blank" rel="noopener">
      📄 {{ fabric_pdf.value.filename | default: 'Fabric Guide PDF' }}
    </a>
  </div>
{% endif %}

Hi @kyle_liu Ai generated this code in the main-product.liquid:
{%- if product.metafields.custom.fabric_guide_pdf != blank -%}
[
Fabric Guide PDF]({{ product.metafields.custom.fabric_guide_pdf }})

{%- endif -%}

Hi @Andrew_Lim

Your code snippet displays data correctly with my theme. Could you provide any further details?