const { posts } = require('../posts');

module.exports = () => `<?xml version="1.0" encoding="utf-8"?>
  <feed xmlns="http://www.w3.org/2005/Atom">
    <title>Logan McAnsh</title>
    <subtitle>Blog</subtitle>
    <link href="https://mcansh.blog/atom" rel="self"/>
    <link href="https://mcansh.blog"/>
    <updated>${posts[0].date}</updated>
    <id>https://mcansh.blog/</id>
    <author>
      <name>Logan McAnsh</name>
      <email>logan@mcan.sh</email>
    </author>
    ${posts.map(({ date, title, slug }) => (`
      <entry>
        <id>${slug}</id>
        <title>${title}</title>
        <link href="https://mcansh.blog/${slug}"/>
        <updated>${date}</updated>
      </entry>
    `)).join('')}
  </feed>
`;

@@ -33,16 +33,46 @@
 sts');%0A%0A
+const newestPost = posts%5B0%5D;%0A%0A
 module.e
@@ -342,24 +342,26 @@
 dated%3E$%7B
-posts%5B0%5D
+newestPost
 .date%7D%3C/

make it a little cleaner