@inglorious/ssx 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/render/index.js +9 -6
- package/src/render/layout.js +2 -0
package/package.json
CHANGED
package/src/render/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const DEFAULT_OPTIONS = {
|
|
|
5
5
|
lang: "en",
|
|
6
6
|
charset: "UTF-8",
|
|
7
7
|
title: "",
|
|
8
|
+
favicon: "",
|
|
8
9
|
meta: {},
|
|
9
10
|
styles: [],
|
|
10
11
|
head: "",
|
|
@@ -26,17 +27,18 @@ export async function renderPage(store, page, entity, options = {}) {
|
|
|
26
27
|
|
|
27
28
|
const getPageOption = createGetPageOption(store, module, entity)
|
|
28
29
|
|
|
29
|
-
const lang = getPageOption("lang", DEFAULT_OPTIONS)
|
|
30
|
-
const charset = getPageOption("charset", DEFAULT_OPTIONS)
|
|
31
|
-
const title = getPageOption("title", DEFAULT_OPTIONS)
|
|
30
|
+
const lang = getPageOption("lang", DEFAULT_OPTIONS) || options.lang
|
|
31
|
+
const charset = getPageOption("charset", DEFAULT_OPTIONS) || options.charset
|
|
32
|
+
const title = getPageOption("title", DEFAULT_OPTIONS) || options.title
|
|
33
|
+
const favicon = getPageOption("favicon", DEFAULT_OPTIONS) || options.favicon
|
|
32
34
|
const meta = { ...options.meta, ...getPageOption("meta", DEFAULT_OPTIONS) }
|
|
33
35
|
const styles = [
|
|
34
|
-
...(options.styles
|
|
36
|
+
...(options.styles || []),
|
|
35
37
|
...getPageOption("styles", DEFAULT_OPTIONS),
|
|
36
38
|
]
|
|
37
|
-
const head = getPageOption("head", DEFAULT_OPTIONS)
|
|
39
|
+
const head = getPageOption("head", DEFAULT_OPTIONS) || options.head
|
|
38
40
|
const scripts = [
|
|
39
|
-
...(options.scripts
|
|
41
|
+
...(options.scripts || []),
|
|
40
42
|
...getPageOption("scripts", DEFAULT_OPTIONS),
|
|
41
43
|
]
|
|
42
44
|
|
|
@@ -45,6 +47,7 @@ export async function renderPage(store, page, entity, options = {}) {
|
|
|
45
47
|
lang,
|
|
46
48
|
charset,
|
|
47
49
|
title,
|
|
50
|
+
favicon,
|
|
48
51
|
meta,
|
|
49
52
|
styles,
|
|
50
53
|
head,
|
package/src/render/layout.js
CHANGED
|
@@ -18,6 +18,7 @@ export function layout(body, options) {
|
|
|
18
18
|
lang = "en",
|
|
19
19
|
charset = "UTF-8",
|
|
20
20
|
title = "",
|
|
21
|
+
favicon = "",
|
|
21
22
|
meta = {},
|
|
22
23
|
styles = [],
|
|
23
24
|
head = "",
|
|
@@ -30,6 +31,7 @@ export function layout(body, options) {
|
|
|
30
31
|
<head>
|
|
31
32
|
<meta charset="${charset}" />
|
|
32
33
|
<title>${title}</title>
|
|
34
|
+
<link rel="icon" type="image/x-icon" href="${favicon}">
|
|
33
35
|
${Object.entries(meta)
|
|
34
36
|
.map(
|
|
35
37
|
([name, content]) => `<meta name="${name}" content="${content}">`,
|