This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2020-07-25 10:21:52 -07:00
|
|
|
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;
|
|
|
|
}
|
2020-09-23 12:29:55 -07:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|