@gudhub/ssg-web-components-library 1.0.113 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/ssg-web-components-library",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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
- let ids = await super.findIds('blog');
49
- await this.findCanonical(ids.appId, ids.itemId, `/blog/${category}/${article}/`);
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
- let ids = await super.findIds('blog');
65
- await this.addTag(ids.appId, ids.itemId, `/blog/${category}/${article}/`, 'blog');
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 = await window?.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;