Parsing error with a XML document

PSalaun
Shopify Partner
5 0 2

Hello,

I'm trying to create a simple products XML feed for my shop, using a custom template for a dedicated page on my website.

My issue so far is that Shopify is not parsing correctly my XML page. This is my code:

 

{% layout none %}
<?xml version="1.0" encoding="UTF-8" ?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
  <channel>
    <title>Title</title>
    <link>Link</link>
    <description>Description</description>
    {% assign collection = collections.all %}
    {% paginate collection.products by 1000 %}
    {% for product in collection.products %}
      {% for variant in product.variants %}
        <item>
          <title>{{ product.title }}</title>
          <link>{{ shop.url}}{{ variant.url }}</link>
          <g:id>{{ variant.id }}</g:id>
          <g:availability>{% if variant.available %}in stock{% else %}out of stock{% endif %}</g:availability>
          <g:image_link>http:{% if variant.image.src %}{{ variant.image.src | product_img_url: 'grande' }}{% else %}{{ product.featured_image.src | product_img_url: 'grande' }}{% endif %}</g:image_link>
          <g:price>{{ BasePrice | money_without_currency }} {{ shop.currency }}</g:price>
          <g:condition>new</g:condition>
          <g:brand>{{ product.vendor }}</g:brand>
          <g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>
          <g:mpn>{{ variant.sku }}</g:mpn>
          {% if variant.barcode %}
            <g:gtin>{{ variant.barcode }}</g:gtin>
          {% endif %}
          <g:shipping_weight>{{ variant.weight | weight_with_unit }}</g:shipping_weight>
        </item>
      {% endfor %}
    {% endfor %}
    {% endpaginate %}
  </channel>
</rss>

 

and the output page at https://myshop.com/pages/xml-feed does not have closing <link> tags, as you can see on the 3rd line:

 

<item>
  <title>My Product</title>
  <link />Link
  <g:id>37733816565936</g:id>
  <g:availability>in stock</g:availability>
  <g:image_link
    >http://cdn.shopify.com/s/files/1/2174/9103/products/test.jpg?v=1614179128</g:image_link
  >
  <g:price> EUR</g:price>
  <g:condition>new</g:condition>
  <g:brand>soothing herbal tea</g:brand>
  <g:product_type>Delbove</g:product_type>
  <g:mpn>TEA2020</g:mpn>

  <g:gtin></g:gtin>

  <g:shipping_weight>0 g</g:shipping_weight>
</item>

 

 

Any idea how I could fix this?

Best regards,

Pierre

Replies 0 (0)