diff --git a/components/expand-data.js b/components/expand-data.js index 12dfde1..8cd2e09 100644 --- a/components/expand-data.js +++ b/components/expand-data.js @@ -13,10 +13,11 @@ export default function(dom, data) { // Dates // TODO: fix updated date - if (data.published) { - data.publishedDate = new Date(data.published); - data.updatedDate = new Date(data.published || data.updated); - + if (data.published){//} && data.journal) { + data.volume = data.published.getFullYear() - 2015; + data.issue = data.published.getMonth() + 1; + } + /* //let RFC = d3.timeFormat("%a, %d %b %Y %H:%M:%S %Z"); let months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]; let zeroPad = (n) => { return n < 10 ? "0" + n : n; }; @@ -28,7 +29,7 @@ export default function(dom, data) { data.publishedDayPadded = zeroPad(data.publishedDate.getDate()); data.volume = data.publishedDate.getFullYear() - 2015; data.issue = data.publishedDate.getMonth() + 1; - } + }*/ diff --git a/components/front-matter.js b/components/front-matter.js index 474a6a9..941b596 100644 --- a/components/front-matter.js +++ b/components/front-matter.js @@ -10,6 +10,9 @@ export default function(dom, data) { data.title = localData.title; data.description = localData.description; + data.published = new Date(localData.published); + data.updated = new Date(localData.published || localData.updated); + data.authors = localData.authors.map((author, i) =>{ let a = {}; let name = Object.keys(author)[0]; @@ -24,6 +27,7 @@ export default function(dom, data) { } return a; }); + } } diff --git a/components/meta.js b/components/meta.js index 891c17b..fa18230 100644 --- a/components/meta.js +++ b/components/meta.js @@ -1,7 +1,13 @@ export default function(dom, data) { let head = dom.querySelector("head"); + let appendHead = html => appendHtml(head, html); - appendHtml(head, ` + function meta(name, content) { + if (content) + appendHead(``); + } + + appendHead(` @@ -9,17 +15,17 @@ export default function(dom, data) {