@gudhub/ssg-web-components-library 1.0.126 → 1.0.128
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
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
itemtype="${json.schema?.offerType || 'https://schema.org/Offer'}"
|
|
51
51
|
>
|
|
52
52
|
<p class="item-price">
|
|
53
|
-
|
|
53
|
+
<span>${item.priceSymbol || '$'}</span><span
|
|
54
54
|
gh-id="${ghId}.items.${index}.price"
|
|
55
55
|
itemprop="${json.schema?.priceProp || 'price'}"
|
|
56
56
|
></span>
|
|
@@ -128,18 +128,37 @@ class MetaTag extends GHComponent {
|
|
|
128
128
|
const generalInfo = this.config.componentsConfigs?.generalInfo?.[0];
|
|
129
129
|
|
|
130
130
|
const {
|
|
131
|
-
title_field_id
|
|
132
|
-
description_field_id
|
|
133
|
-
slug_field_id
|
|
134
|
-
image_field_id
|
|
135
|
-
|
|
131
|
+
title_field_id,
|
|
132
|
+
description_field_id,
|
|
133
|
+
slug_field_id,
|
|
134
|
+
image_field_id,
|
|
135
|
+
meta_title_field_id,
|
|
136
|
+
meta_description_field_id,
|
|
137
|
+
meta_image_field_id,
|
|
136
138
|
app_id: chapterAppId
|
|
137
139
|
} = chapterConfig;
|
|
138
140
|
|
|
139
|
-
const
|
|
141
|
+
const titleId =
|
|
142
|
+
this.getAttribute('data-meta-title') ||
|
|
143
|
+
meta_title_field_id ||
|
|
144
|
+
title_field_id;
|
|
145
|
+
|
|
146
|
+
const descriptionId =
|
|
147
|
+
this.getAttribute('data-meta-description') ||
|
|
148
|
+
meta_description_field_id ||
|
|
149
|
+
description_field_id;
|
|
150
|
+
|
|
151
|
+
const imageId =
|
|
152
|
+
this.getAttribute('data-meta-image') ||
|
|
153
|
+
meta_image_field_id ||
|
|
154
|
+
image_field_id;
|
|
155
|
+
|
|
156
|
+
const slugId = slug_field_id;
|
|
140
157
|
|
|
141
158
|
const getFieldValue = (fieldId) => {
|
|
142
|
-
return fields.find(
|
|
159
|
+
return fields.find(
|
|
160
|
+
field => String(field.field_id) === String(fieldId)
|
|
161
|
+
)?.field_value ?? null;
|
|
143
162
|
};
|
|
144
163
|
|
|
145
164
|
const isNumeric = (val) => {
|
|
@@ -165,7 +184,7 @@ class MetaTag extends GHComponent {
|
|
|
165
184
|
let titleValue = getFieldValue(titleId);
|
|
166
185
|
let descriptionValue = getFieldValue(descriptionId);
|
|
167
186
|
let slugValue = getFieldValue(slugId);
|
|
168
|
-
let imageValue = getFieldValue(
|
|
187
|
+
let imageValue = getFieldValue(imageId);
|
|
169
188
|
|
|
170
189
|
[titleValue, descriptionValue, slugValue, imageValue] = await Promise.all([
|
|
171
190
|
resolveValue(titleValue, 'text'),
|
|
@@ -176,7 +195,7 @@ class MetaTag extends GHComponent {
|
|
|
176
195
|
|
|
177
196
|
let imageUrl = imageValue;
|
|
178
197
|
|
|
179
|
-
if (!
|
|
198
|
+
if (!meta_image_field_id && !this.getAttribute('data-meta-image')) {
|
|
180
199
|
const itemFields = await gudhub.getItem(chapterAppId, chapterItemId);
|
|
181
200
|
|
|
182
201
|
const currentFieldData = itemFields?.fields?.find(
|
|
@@ -193,7 +212,7 @@ class MetaTag extends GHComponent {
|
|
|
193
212
|
}
|
|
194
213
|
}
|
|
195
214
|
|
|
196
|
-
if (
|
|
215
|
+
if ((meta_image_field_id || this.getAttribute('data-meta-image')) && imageUrl) {
|
|
197
216
|
const protocol = window.MODE === 'production' ? 'https' : 'http';
|
|
198
217
|
const website = window.getConfig()?.website;
|
|
199
218
|
imageUrl = `${protocol}://${website}${imageUrl}`
|