pecotamic / sitemap

Sitemap for Statamic v3
6 stars 9 forks source link

Antlers template won't output entries details #16

Closed steffenschmidt closed 3 years ago

steffenschmidt commented 3 years ago

I have the following antlers template:

{{ xml_header }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ entries }}
  <url>
    <loc>{{ loc }}</loc>
    <lastmod>{{ lastmod format="c" }}</lastmod>
    <changefreq>{{ changefreq or 'weekly' }}</changefreq>
    <priority>{{ priority or '0.8' }}</priority>
  </url>
{{ /entries }}
</urlset>

My expected output would be:

<?xml version="1.0" encoding="UTF-8"?>
<urlset>
  <url>
    <loc>https://www.mydomain.com</loc>
    <lastmod>2021-09-24T20:36:37+02:00</lastmod>
    <priority>1</priority>
  </url>
  <url>
    <loc>https://www.mydomain.com/blog</loc>
    <lastmod>2021-10-06T11:25:11+02:00</lastmod>
    <priority>0.8</priority>
  </url>
  ...
</urlset>

Instead I got empty entries and my defaults are used everywhere:

<urlset>
  <url>
    <loc></loc>
    <lastmod></lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.5</priority>
  </url>
  <url>
    <loc></loc>
    <lastmod></lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.5</priority>
  </url>
  ...
</urlset>

For the missing xml header I opened another issue (#15) so you can ignore this here. What am I missing?

werner-freytag commented 3 years ago

Fixed in release 1.2.7