Refactor - Get games from spreadsheet - Push to collections, not data files - Setup template for collection item
Diff
_config.yml | 8 +++++++-
index.html | 14 --------------
signup.html | 13 -------------
_data/games.yml | 49 +++++++++++++++++++++++--------------------------
_includes/footer.html | 2 +-
_layouts/game.html | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
_scripts/fetch_manifest.js | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
pages/index.html | 15 +++++++++++++++
pages/signup.html | 13 +++++++++++++
9 files changed, 224 insertions(+), 58 deletions(-)
@@ -209,4 +209,10 @@
compress_html:
clippings: all
ignore:
envs: development
envs: development
collections:
games:
output: true
permalink: /game/:path/
@@ -1,14 +1,0 @@
---
layout: single
title: Hello!
---
We are a Bangalore-based board games collective.
Which is just a fancy way of saying we are a couple of friends who play board games and have a lot of free time.
We've still got a bit of work to do on the site so until then, find us on Facebook, Twitter and Telegram.
<a class="btn btn--facebook" href="https://facebook.com/ReRollBLR"><i class="fa fa-fw fa-facebook"></i> ReRoll Games</a>
<a class="btn btn--twitter" href="https://twitter.com/ReRoll_BLR"><i class="fa fa-fw fa-twitter"></i> @ReRoll_BLR</a>
<a class="btn btn--linkedin" href="https://telegram.me/reroll"><i class="fa fa-fw fa-paper-plane" aria-hidden="true"></i> @ReRoll</a>
@@ -1,13 +1,0 @@
---
layout: single
title: Sign Up!
permalink: /signup
---
{% include mailchimp.html %}
<h2>You can also follow us at</h2>
<a class="btn btn--facebook" href="https://facebook.com/ReRollBLR"><i class="fa fa-fw fa-facebook"></i> ReRoll Games</a>
<a class="btn btn--twitter" href="https://twitter.com/ReRoll_BLR"><i class="fa fa-fw fa-twitter"></i> @ReRoll_BLR</a>
<a class="btn btn--linkedin" href="https://telegram.me/reroll"><i class="fa fa-fw fa-paper-plane" aria-hidden="true"></i> @ReRoll</a>
@@ -1,31 +1,22 @@
---
events:
"humming-tree-2":
- cash_n_guns
- love_letter
- spaceteam
- machi_koro
- citadels
- jaipur
- codenames
- saboteur
- avalon
- greed
- age_of_war
- dixit
- takenoko
board_game_geek:
spaceteam: 184491
love_letter: 129622
cash_n_guns: 155362
machi_koro: 143884
citadels: 478
jaipur: 54043
codenames: 178900
saboteur: 9220
avalon: 128882
greed: 151247
age_of_war: 155695
dixit: 39856
takenoko: 70919
humming-tree-2:
games:
- cash_n_guns
- love_letter
- spaceteam
- machi_koro
- citadels
- jaipur
- codenames
- saboteur
- avalon
- greed
- age_of_war
- dixit
- takenoko
venue: The Humming Tree
date:
tickets:
@@ -21,5 +21,5 @@
</ul>
</div>
<div class="page__footer-copyright">© {{ site.time | date: '%Y' }} {{ site.name | default: site.title }}. Run by <a href="https://www.facebook.com/kaushik.narayan.39"><i class="fa fa-fw fa-facebook"></i> Kaushik</a>, <a href="https://twitter.com/karthikb351"><i class="fa fa-fw fa-twitter"></i> @karthikb351</a> and <a href="https://twitter.com/mithunbalraj"><i class="fa fa-fw fa-twitter"></i> @mithunbalraj</a>.
<div class="page__footer-copyright">© {{ site.time | date: '%Y' }} {{ site.name | default: site.title }} run by <a href="https://www.facebook.com/kaushik.narayan.39"><i class="fa fa-fw fa-facebook"></i> Kaushik</a>, <a href="https://twitter.com/karthikb351"><i class="fa fa-fw fa-twitter"></i> @karthikb351</a> and <a href="https://twitter.com/mithunbalraj"><i class="fa fa-fw fa-twitter"></i> @mithunbalraj</a>.
</div>
@@ -1,0 +1,77 @@
---
layout: default
---
{% include base_path %}
{% if (page.header.overlay_color or page.header.overlay_image) or page.header.image %}
{% include page__hero.html %}
{% endif %}
{% if page.url != "/" and site.breadcrumbs %}
{% unless paginator %}
{% include breadcrumbs.html %}
{% endunless %}
{% endif %}
<div id="main" role="main">
{% include sidebar.html %}
<article class="page" itemscope itemtype="http://schema.org/CreativeWork">
{% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date: "%B %d, %Y" }}">{% endif %}
{% if page.modified %}<meta itemprop="dateModified" content="{{ page.modified | date: "%B %d, %Y" }}">{% endif %}
<div class="page__inner-wrap">
{% unless page.header.overlay_color or page.header.overlay_image %}
<header>
{% if page.title %}<h1 class="page__title" itemprop="headline">{{ page.title | markdownify | remove: "<p>" | remove: "</p>" }}</h1>{% endif %}
{% if page.read_time %}
<p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
</header>
{% endunless %}
<section class="page__content" itemprop="text">
<img src="{{ page.game.thumbnail }}">
<p>{{ page.game.description }}</p>
{% if page.link %}<div><a href="{{ page.link }}" class="btn">{{ site.data.ui-text[site.locale].ext_link_label | default: "Direct Link" }}</a></div>{% endif %}
</section>
<footer class="page__meta">
{% if site.data.ui-text[site.locale].meta_label %}
<h4 class="page__meta-title">{{ site.data.ui-text[site.locale].meta_label }}</h4>
{% endif %}
{% include page__taxonomy.html %}
{% if page.modified %}
<p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong> <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time></p>
{% elsif page.date %}
<p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong> <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time></p>
{% endif %}
</footer>
{% if page.share %}{% include social-share.html %}{% endif %}
{% include post_pagination.html %}
</div>
{% if site.comments.provider and page.comments %}
{% include comments.html %}
{% endif %}
</article>
{% comment %}{% endcomment %}
{% if page.id and page.related and site.related_posts.size > 0 %}
<div class="page__related">
{% if site.data.ui-text[site.locale].related_label %}
<h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
{% endif %}
<div class="grid__wrapper">
{% for post in site.related_posts limit:4 %}
{% include archive-single.html type="grid" %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
@@ -1,0 +1,91 @@
var Tabletop = require('tabletop');
var async = require('async');
var YAML = require('yamljs');
var fs = require('fs');
var options = {
timeout: 10000,
retry: {
initial: 100,
multiplier: 2,
max: 15e3
}
}
var bgg = require('bgg')(options);
var sheets = [
{
name: "Board Games",
url: 'https://docs.google.com/spreadsheets/d/1Mk8dK_QESBX3GQ8e2F7wPtdF74V9gw0ohhU5UHGJK5Y/pubhtml',
sheetName: "Inventory",
}
];
async.forEach(sheets, function (item, callback){
function writeData(dataSet, tabletop) {
var keys = tabletop.sheets(item.sheetName)['column_names'];
var gamesList = tabletop.sheets(item.sheetName).toArray();
async.forEach(gamesList, function (game, cb) {
var bgg_id = game[keys.indexOf('bgg_id')];
bgg('thing', {type: 'boardgame', id: bgg_id})
.then(function(results){
bgg_response = results['items']['item'];
var name = "";
for (var i = 0; i < bgg_response.name.length; i++) {
var n = bgg_response.name[i];
if(n.type == 'primary')
name = n.value;
}
var gameData = {
name: name,
description: bgg_response.description,
bgg_id: bgg_response.id,
thumbnail: bgg_response.thumbnail,
image: bgg_response.image,
minPlayers: bgg_response.minplayers.value,
maxPlayers: bgg_response.maxplayers.value,
yearPublished: bgg_response.yearpublished.value,
playTime: bgg_response.playingtime.value,
short_id: game[keys.indexOf('short_id')],
comment: game[keys.indexOf('comment')],
buy_url: game[keys.indexOf('buy_url')],
buy_type: game[keys.indexOf('buy_type')],
};
var yamlFrontMatter =
"---\n"+
YAML.stringify( {
layout: 'game',
title: gameData.name,
game: gameData,
}, 2)
+"\n---";
var file = '_games/'+game[keys.indexOf('short_id')]+'.md';
fs.writeFileSync(file, yamlFrontMatter);
console.log(yamlFrontMatter);
cb();
});
}, function(err){
callback();
});
}
Tabletop.init( { key: item.url,
callback: writeData,
wanted: [item.sheetName],
simpleSheet: false } )
}, function(err) {
console.log('Done');
});
@@ -1,0 +1,15 @@
---
layout: single
title: Hello!
permalink: /
---
We are a Bangalore-based board games collective.
Which is just a fancy way of saying we are a couple of friends who play board games and have a lot of free time.
We've still got a bit of work to do on the site so until then, find us on Facebook, Twitter and Telegram.
<a class="btn btn--facebook" href="https://facebook.com/ReRollBLR"><i class="fa fa-fw fa-facebook"></i> ReRoll Games</a>
<a class="btn btn--twitter" href="https://twitter.com/ReRoll_BLR"><i class="fa fa-fw fa-twitter"></i> @ReRoll_BLR</a>
<a class="btn btn--linkedin" href="https://telegram.me/reroll"><i class="fa fa-fw fa-paper-plane" aria-hidden="true"></i> @ReRoll</a>
@@ -1,0 +1,13 @@
---
layout: single
title: Sign Up!
permalink: /signup
---
{% include mailchimp.html %}
<h2>You can also follow us at</h2>
<a class="btn btn--facebook" href="https://facebook.com/ReRollBLR"><i class="fa fa-fw fa-facebook"></i> ReRoll Games</a>
<a class="btn btn--twitter" href="https://twitter.com/ReRoll_BLR"><i class="fa fa-fw fa-twitter"></i> @ReRoll_BLR</a>
<a class="btn btn--linkedin" href="https://telegram.me/reroll"><i class="fa fa-fw fa-paper-plane" aria-hidden="true"></i> @ReRoll</a>