-
Notifications
You must be signed in to change notification settings - Fork 19
/
root.bemtree.js
40 lines (38 loc) · 1.4 KB
/
root.bemtree.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
block('root')({
replace: (node, ctx) => {
const data = node.data = ctx.data;
const meta = data.meta || {};
const og = meta.og || {};
if (ctx.context) return ctx.context;
return {
block: 'page',
title: data.title,
favicon: '/favicon.ico',
styles: [
{
elem: 'css',
url: '/index.min.css'
}
],
scripts: [
{
elem: 'js',
url: '/index.min.js'
}
],
head: [
{ elem: 'meta', attrs: { name: 'description', content: meta.description } },
{ elem: 'meta', attrs: { property: 'og:title', content: og.title || data.title } },
{ elem: 'meta', attrs: { property: 'og:url', content: og.url } },
{ elem: 'meta', attrs: { property: 'og:site_name', content: og.siteName } },
{ elem: 'meta', attrs: { property: 'og:locale', content: og.locale || 'en_US' } },
{ elem: 'meta', attrs: { property: 'og:type', content: 'website' } },
{ elem : 'meta', attrs : { name : 'viewport', content : 'width=device-width, initial-scale=1' } }
],
mods: {
theme: 'islands',
view: data.view
}
};
}
});