@gudhub/ssg-web-components-library 1.0.112 → 1.0.114
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
CHANGED
|
@@ -45,8 +45,22 @@ class CanonicalComponent extends GHComponent {
|
|
|
45
45
|
let ids = await super.findIds('blog');
|
|
46
46
|
await this.findCanonical(ids.appId, ids.itemId, `/blog/authors/${author}/`);
|
|
47
47
|
} else if (article != null) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const chapter = document.querySelector('[data-chapter]')
|
|
49
|
+
? document.querySelector('[data-chapter]').getAttribute('data-chapter')
|
|
50
|
+
: 'blog';
|
|
51
|
+
|
|
52
|
+
let ids = await super.findIds(chapter);
|
|
53
|
+
|
|
54
|
+
let slug;
|
|
55
|
+
|
|
56
|
+
if (category) {
|
|
57
|
+
slug = `/${chapter}/${category}/${article}/`;
|
|
58
|
+
} else {
|
|
59
|
+
const path = url.searchParams.get('path');
|
|
60
|
+
slug = path || false;
|
|
61
|
+
}
|
|
62
|
+
await this.findCanonical(ids.appId, ids.itemId, slug);
|
|
63
|
+
|
|
50
64
|
} else {
|
|
51
65
|
const getCurrentChapter = await window?.getCurrentChapter();
|
|
52
66
|
const currentChapter = getCurrentChapter ? getCurrentChapter : 'pages';
|
|
@@ -61,10 +61,27 @@ class MetaTag extends GHComponent {
|
|
|
61
61
|
let ids = await super.findIds('blog');
|
|
62
62
|
await this.addTag(ids.appId, ids.itemId, `/blog/authors/${author}/`, 'blog');
|
|
63
63
|
} else if (article != null) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const chapter = document.querySelector('[data-chapter]')
|
|
65
|
+
? document.querySelector('[data-chapter]').getAttribute('data-chapter')
|
|
66
|
+
: 'blog';
|
|
67
|
+
|
|
68
|
+
let ids = await super.findIds(chapter);
|
|
69
|
+
|
|
70
|
+
let slug;
|
|
71
|
+
|
|
72
|
+
if (category) {
|
|
73
|
+
slug = `/${chapter}/${category}/${article}/`;
|
|
74
|
+
} else {
|
|
75
|
+
const path = url.searchParams.get('path');
|
|
76
|
+
slug = path || false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await this.addTag(ids.appId, ids.itemId, slug, chapter);
|
|
80
|
+
|
|
66
81
|
} else {
|
|
67
|
-
const getCurrentChapter =
|
|
82
|
+
const getCurrentChapter = document.querySelector('meta-tag')
|
|
83
|
+
? document.querySelector('meta-tag').getAttribute('data-chapter')
|
|
84
|
+
: await window?.getCurrentChapter();
|
|
68
85
|
const currentChapter = getCurrentChapter ? getCurrentChapter : 'pages';
|
|
69
86
|
|
|
70
87
|
let slug = false;
|
|
@@ -277,16 +294,18 @@ class MetaTag extends GHComponent {
|
|
|
277
294
|
|
|
278
295
|
} else {
|
|
279
296
|
const meta = document.createElement('meta');
|
|
280
|
-
|
|
281
|
-
if (this.type
|
|
282
|
-
name
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
297
|
+
|
|
298
|
+
if (this.type === 'title') {
|
|
299
|
+
meta.setAttribute('name', 'title');
|
|
300
|
+
meta.setAttribute('content', titleValue);
|
|
301
|
+
} else if (this.type === 'description') {
|
|
302
|
+
meta.setAttribute('name', 'description');
|
|
303
|
+
meta.setAttribute('content', descriptionValue);
|
|
304
|
+
} else if (this.type === 'meta_image_src') {
|
|
305
|
+
meta.setAttribute('name', 'image');
|
|
306
|
+
meta.setAttribute('content', imageUrl);
|
|
287
307
|
}
|
|
288
|
-
|
|
289
|
-
meta.setAttribute('content', value);
|
|
308
|
+
|
|
290
309
|
document.querySelector('head').prepend(meta);
|
|
291
310
|
}
|
|
292
311
|
|