@parameter1/base-cms-marko-web 3.13.5 → 3.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/components/element/content/marko.json +11 -0
- package/components/element/content/transcript.marko +22 -0
- package/components/page/metadata/content.marko +5 -0
- package/components/page/metadata/google-structured-data/content.js +9 -0
- package/express/website-context.js +4 -1
- package/package.json +4 -2
@@ -20,6 +20,17 @@
|
|
20
20
|
"@attrs": "object",
|
21
21
|
"@link": "expression"
|
22
22
|
},
|
23
|
+
"<marko-web-content-transcript>": {
|
24
|
+
"template": "./transcript.marko",
|
25
|
+
"<embed-options>": {},
|
26
|
+
"@block-name": "string",
|
27
|
+
"@obj": "object",
|
28
|
+
"@tag": "string",
|
29
|
+
"@class": "string",
|
30
|
+
"@modifiers": "string",
|
31
|
+
"@attrs": "object",
|
32
|
+
"@link": "expression"
|
33
|
+
},
|
23
34
|
"<marko-web-content-byline>": {
|
24
35
|
"template": "./byline.marko",
|
25
36
|
"@block-name": "string",
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { get, getAsObject } from "@parameter1/base-cms-object-path";
|
2
|
+
import extractRender from "../extract-render";
|
3
|
+
|
4
|
+
$ const transcript = get(input.obj, "transcript");
|
5
|
+
$ const v = transcript == null ? "" : `${transcript}`.trim();
|
6
|
+
$ const obj = { transcript: v };
|
7
|
+
|
8
|
+
<if(v)>
|
9
|
+
<marko-web-obj-text
|
10
|
+
type="content"
|
11
|
+
block-name=input.blockName
|
12
|
+
obj=obj
|
13
|
+
field="transcript"
|
14
|
+
html=true
|
15
|
+
tag=input.tag
|
16
|
+
class=input.class
|
17
|
+
modifiers=input.modifiers
|
18
|
+
attrs=input.attrs
|
19
|
+
link=input.link
|
20
|
+
...extractRender(input)
|
21
|
+
/>
|
22
|
+
</if>
|
@@ -33,10 +33,15 @@ fragment ContentPageMetadataFragment on Content {
|
|
33
33
|
}
|
34
34
|
... on ContentVideo {
|
35
35
|
embedSrc
|
36
|
+
transcript
|
36
37
|
}
|
37
38
|
... on ContentPodcast {
|
38
39
|
fileSrc
|
39
40
|
fileName
|
41
|
+
transcript
|
42
|
+
}
|
43
|
+
... on ContentWebinar {
|
44
|
+
transcript
|
40
45
|
}
|
41
46
|
... on Authorable {
|
42
47
|
authors {
|
@@ -1,4 +1,11 @@
|
|
1
1
|
const objectPath = require('@parameter1/base-cms-object-path');
|
2
|
+
const cheerio = require('cheerio');
|
3
|
+
|
4
|
+
const convertHtmlToString = (value) => {
|
5
|
+
if (!value) return null;
|
6
|
+
const $ = cheerio.load(value);
|
7
|
+
return $.text();
|
8
|
+
};
|
2
9
|
|
3
10
|
const { getAsArray } = objectPath;
|
4
11
|
|
@@ -49,6 +56,7 @@ module.exports = (node) => {
|
|
49
56
|
uploadDate: publishedISOString,
|
50
57
|
contentUrl: get(node, 'siteContext.canonicalUrl'),
|
51
58
|
embedUrl: get(node, 'embedSrc'),
|
59
|
+
...(get(node, 'transcript') && convertHtmlToString(get(node, 'transcript')) && { transcript: convertHtmlToString(get(node, 'transcript')) }),
|
52
60
|
});
|
53
61
|
}
|
54
62
|
|
@@ -66,6 +74,7 @@ module.exports = (node) => {
|
|
66
74
|
'@type': 'PodcastEpisode',
|
67
75
|
headline: get(node, 'metadata.title'),
|
68
76
|
...(associatedMedia && { associatedMedia }),
|
77
|
+
...(get(node, 'transcript') && convertHtmlToString(' ') && { transcript: convertHtmlToString(' ') }),
|
69
78
|
});
|
70
79
|
}
|
71
80
|
|
@@ -1,16 +1,19 @@
|
|
1
1
|
const loadWebsite = require('@parameter1/base-cms-web-common/website-context');
|
2
2
|
const { asyncRoute } = require('@parameter1/base-cms-utils');
|
3
|
+
const { setDayjsLocale } = require('@parameter1/base-cms-dayjs/utils');
|
3
4
|
|
4
5
|
module.exports = coreConfig => asyncRoute(async (req, res, next) => {
|
5
6
|
const { apollo } = res.locals;
|
6
7
|
const websiteContext = await loadWebsite(apollo);
|
7
8
|
coreConfig.setWebsiteContext(websiteContext);
|
8
9
|
|
10
|
+
const locale = coreConfig.website('date.locale');
|
9
11
|
// Set marko core date config.
|
10
12
|
req.app.locals.markoCoreDate = {
|
11
13
|
timezone: coreConfig.website('date.timezone'),
|
12
|
-
locale
|
14
|
+
locale,
|
13
15
|
format: coreConfig.website('date.format'),
|
14
16
|
};
|
17
|
+
setDayjsLocale({ locale });
|
15
18
|
next();
|
16
19
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parameter1/base-cms-marko-web",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.17.0",
|
4
4
|
"description": "Core Marko+Express components for BaseCMS websites",
|
5
5
|
"author": "Jacob Bare <jacob@parameter1.com>",
|
6
6
|
"main": "index.js",
|
@@ -16,6 +16,7 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@godaddy/terminus": "^4.9.0",
|
18
18
|
"@parameter1/base-cms-apollo-ssr": "^3.0.0",
|
19
|
+
"@parameter1/base-cms-dayjs": "^3.17.0",
|
19
20
|
"@parameter1/base-cms-embedded-media": "^3.13.5",
|
20
21
|
"@parameter1/base-cms-express-apollo": "^3.0.0",
|
21
22
|
"@parameter1/base-cms-graphql-fragment-types": "^3.0.0",
|
@@ -26,6 +27,7 @@
|
|
26
27
|
"@parameter1/base-cms-tenant-context": "^3.0.0",
|
27
28
|
"@parameter1/base-cms-utils": "^3.0.0",
|
28
29
|
"@parameter1/base-cms-web-common": "^3.3.1",
|
30
|
+
"cheerio": "^1.0.0-rc.10",
|
29
31
|
"cookie-parser": "^1.4.5",
|
30
32
|
"express": "^4.17.1",
|
31
33
|
"express-http-proxy": "^1.6.2",
|
@@ -46,5 +48,5 @@
|
|
46
48
|
"publishConfig": {
|
47
49
|
"access": "public"
|
48
50
|
},
|
49
|
-
"gitHead": "
|
51
|
+
"gitHead": "07197c04a5e52edebb39e58b8574451f1390b3b1"
|
50
52
|
}
|