Parsing error with a XML document

Shopify Partner
5 0 2


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="" version="2.0">
    {% assign collection = collections.all %}
    {% paginate collection.products by 1000 %}
    {% for product in collection.products %}
      {% for variant in product.variants %}
          <title>{{ product.title }}</title>
          <link>{{ shop.url}}{{ variant.url }}</link>
          <g: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: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>
      {% endfor %}
    {% endfor %}
    {% endpaginate %}


and the output page at does not have closing <link> tags, as you can see on the 3rd line:


  <title>My Product</title>
  <link />Link
  <g:availability>in stock</g:availability>
  <g:price> EUR</g:price>
  <g:brand>soothing herbal tea</g:brand>


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



Any idea how I could fix this?

Best regards,