export const buildDict = (fn, ...args) => { const dict = {}; for (let [key, value] of fn(...args)) { dict[key] = value; } return dict; } export const buildList = (fn, ...args) => { const list = []; for (let value of fn(...args)) { list.push(value); } return list; } export const head = ({title, description, banner}) => { const meta = { meta: [] }; if (title) { title += ' • Zaimki.pl'; meta.title = title; meta.meta.push({ hid: 'og:title', property: 'og:title', content: title }); meta.meta.push({ hid: 'twitter:title', property: 'twitter:title', content: title }); } if (description) { meta.meta.push({ hid: 'description', name: 'description', content: description }); meta.meta.push({ hid: 'og:description', property: 'og:description', content: description }); meta.meta.push({ hid: 'twitter:description', property: 'twitter:description', content: description }); } if (banner) { banner = process.env.baseUrl + '/' + banner; meta.meta.push({ hid: 'og:logo', property: 'og:logo', content: banner }); meta.meta.push({ hid: 'twitter:image', property: 'twitter:image', content: banner }); } return meta; }