{"tiddlers":{"RenderSitemap":{"title":"RenderSitemap","created":"20150104141300000","creator":"Jim","extension":".xml","modified":"20150104141300000","modifier":"Jim","tags":"static $:/tags/Exporter","type":"text/vnd.tiddlywiki","text":"\\define renderContent()\n<$text text=<<sitemapentries filter:\"\"\"$(exportFilter)$\"\"\">>/>\n\\end\n<<renderContent>>"},"sitemap":{"title":"sitemap","created":"20150104144500000","creator":"Jim","modified":"20150104144500000","modifier":"Jim","tags":"static","type":"text/vnd.tiddlywiki","text":"\\define tv-wikilink-template() #$uri_encoded$\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n`<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">`<$set name=\"exportFilter\" value=\"[!is[system]!title[Table of Contents]!sort[modifed]]\">\n{{RenderSitemap}}</$set>`</urlset>`"},"sitemapentries.js":{"title":"sitemapentries.js","created":"20150104141600000","creator":"Jim","modified":"20150124151600000","modifier":"Jim","module-type":"macro","tags":"static","type":"application/javascript","text":"/*\\\nMacro to output tiddlers matching a filter to sitemap.xml entries.\nhttp://www.sitemaps.org/protocol.html\n\\*/\n(function () {\n  /*jslint node: true, browser: true */\n  /*global $tw: false */\n  'use strict';\n\n  exports.name = 'sitemapentries';\n\n  exports.params = [{ name: 'filter' }];\n\n  let XML = {};\n\n  XML.escapify = function (input) {\n    return input\n      .replace(/</gm, '&lt;')\n      .replace(/>/gm, '&gt;')\n      .replace(/&/gm, '&amp;')\n      .replace(/\"/gm, '&quot;')\n      .replace(/'/gm, '&apos;');\n  };\n\n  XML.twDateToWebDate = function (twDate) {\n    return $tw.utils.formatDateString(twDate, 'YYYY-0MM-0DD');\n  };\n\n  XML.stringify = function (data) {\n    let x = '';\n    data.forEach(function (element, index, array) {\n      x += '\\t<url>\\n';\n      const server = $tw.wiki.getTiddlerText('sitemapserver', '');\n      x += `\\t\\t<loc>${server}#:${element.title.replace(/ /g, '%2520')}</loc>\\n`;\n      if (element.modified) {\n        x += '\\t\\t<lastmod>' + XML.twDateToWebDate($tw.utils.parseDate(element.modified)) + '</lastmod>\\n';\n      }\n      x += '\\t\\t<changefreq>';\n      if (element.title.toLowerCase() === 'index' || element.title.toLowerCase() === 'home') {\n        x += 'weekly';\n      } else {\n        x += 'monthly';\n      }\n      x += '</changefreq>\\n';\n      x += '\\t\\t<priority>';\n      if (element.title.toLowerCase() === 'index' || element.title.toLowerCase() === 'home') {\n        x += '1.0';\n      } else if (element.color !== undefined) {\n        x += '0.8';\n      } else {\n        x += '0.5';\n      }\n      x += '</priority>\\n';\n      x += '\\t</url>\\n';\n    });\n    return x;\n  };\n\n  exports.run = function (filter) {\n    const tiddlers = this.wiki.filterTiddlers(filter);\n    const data = [];\n    for (let t = 0; t < tiddlers.length; t++) {\n      const tiddler = this.wiki.getTiddler(tiddlers[t]);\n      if (tiddler) {\n        const fields = {};\n        for (const field in tiddler.fields) {\n          fields[field] = XML.escapify(tiddler.getFieldString(field));\n        }\n        data.push(fields);\n      }\n    }\n    return XML.stringify(data);\n  };\n})();\n"},"sitemapserver":{"title":"sitemapserver","created":"20150104145100000","creator":"Jim","modified":"20150104145100000","modifier":"Jim","tags":"static","type":"text/vnd.tiddlywiki","text":"https://onetwo.ren/wiki/"}}}