LOGIN
Robert Lancer
Chief Technology Officer at Collaborizm (Project Leader)
 · New YorkU.S.
Edit
Delete
Share
Report
INSPIRATION

Generating site maps using es6 template strings.

    r.db("collab").table("discussions").orderBy({index: r.desc('touchRank')}).pluck('id', 'touchRank', 'createdOn', 'lastReplyOn').run().then(results=> {
      res.send(`<?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        ${results.map(row=> {
          const {id, lastReplyOn, createdOn} = row;
          if (lastReplyOn || createdOn)
            return `<url>
                <loc>${config.basepath}/thread/${id}</loc>
                <lastmod>${(lastReplyOn || createdOn).toISOString()}</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
              </url>`;
          else
            return '';
        }).join('')}</urlset>`
      );
    })

Javascript #RethinkDB

Javascript
2 likes 
Like
Share
Leave a reply...
DISCOVER
CHAT
ALERTS
-2
DISCUSSIONS
-1
FEED