@griddo/cx 1.75.34 → 1.75.36
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 +3 -3
- package/src/components/template.js +97 -65
- package/src/utils/helpers.js +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/cx",
|
|
3
3
|
"description": "Griddo SSG based on Gatsby",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.36",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"react-helmet": "^6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
68
|
+
"@griddo/eslint-config-back": "^1.75.36",
|
|
69
69
|
"eslint": "^7.5.0",
|
|
70
70
|
"eslint-plugin-node": "^11.1.0",
|
|
71
71
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "2d221923450bac0e467a2f6b3c30db8b29a9f5f0"
|
|
101
101
|
}
|
|
@@ -21,29 +21,36 @@ import { formatImage, cleanCommaSeparated } from '../utils/helpers';
|
|
|
21
21
|
// strategy works, maybe we want to isolate `<Head>` in its own file as we did
|
|
22
22
|
// with seo.js.
|
|
23
23
|
//
|
|
24
|
-
export const Head =
|
|
24
|
+
export const Head = data => {
|
|
25
25
|
// ^^^^^^^^^^^
|
|
26
26
|
// A context object which is passed in during the creation of the page
|
|
27
27
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
pageContext: {
|
|
29
|
+
siteMetadata,
|
|
30
|
+
pageMetadata,
|
|
31
|
+
siteOptions,
|
|
32
|
+
locale,
|
|
33
|
+
openGraph,
|
|
34
|
+
componentsVersion,
|
|
35
|
+
griddoVersion,
|
|
36
|
+
page: {
|
|
37
|
+
fullUrl,
|
|
38
|
+
},
|
|
39
39
|
},
|
|
40
|
-
} =
|
|
40
|
+
} = data;
|
|
41
41
|
|
|
42
42
|
const metaRobots = cleanCommaSeparated(
|
|
43
43
|
`${pageMetadata?.index},${pageMetadata?.follow},${pageMetadata?.translate},${pageMetadata?.metasAdvanced}`
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
const showMetaRobots =
|
|
46
|
+
const showMetaRobots =
|
|
47
|
+
!!metaRobots &&
|
|
48
|
+
(siteOptions?.showBasicMetaRobots || metaRobots !== 'index,follow');
|
|
49
|
+
|
|
50
|
+
const { analyticsScript, analyticsDimensions } = composeAnalytics(
|
|
51
|
+
data,
|
|
52
|
+
generateAutomaticDimensions
|
|
53
|
+
);
|
|
47
54
|
|
|
48
55
|
const emptyCodeScript = { props: { dangerouslySetInnerHTML: {} } };
|
|
49
56
|
|
|
@@ -72,15 +79,11 @@ export const Head = ({ pageContext }) => {
|
|
|
72
79
|
} = fixedAnalyticsCode;
|
|
73
80
|
|
|
74
81
|
// Resize favicon
|
|
75
|
-
const faviconResized = formatImage(
|
|
76
|
-
siteMetadata?.favicon,
|
|
77
|
-
32,
|
|
78
|
-
32,
|
|
79
|
-
'png'
|
|
80
|
-
);
|
|
82
|
+
const faviconResized = formatImage(siteMetadata?.favicon, 32, 32, 'png');
|
|
81
83
|
|
|
82
84
|
// Validate options
|
|
83
|
-
const cleanPageLanguages =
|
|
85
|
+
const cleanPageLanguages =
|
|
86
|
+
pageMetadata?.pageLanguages?.filter(item => item.isLive) || [];
|
|
84
87
|
|
|
85
88
|
const useCanonical =
|
|
86
89
|
!!pageMetadata?.canonical &&
|
|
@@ -98,60 +101,87 @@ export const Head = ({ pageContext }) => {
|
|
|
98
101
|
pageMetadata?.index === 'index' &&
|
|
99
102
|
cleanPageLanguages.length > 1;
|
|
100
103
|
|
|
104
|
+
const currentTime = new Date().toString();
|
|
105
|
+
|
|
101
106
|
return (
|
|
102
107
|
<>
|
|
103
108
|
{!!pageMetadata?.title && <title>{pageMetadata?.title}</title>}
|
|
104
|
-
{!!pageMetadata?.description &&
|
|
109
|
+
{!!pageMetadata?.description && (
|
|
110
|
+
<meta name="description" content={pageMetadata?.description} />
|
|
111
|
+
)}
|
|
105
112
|
{siteOptions?.useMetaTitle && (
|
|
106
113
|
<meta name="title" content={pageMetadata?.title} />
|
|
107
114
|
)}
|
|
108
|
-
{useCanonical &&
|
|
109
|
-
<link rel="canonical" href={pageMetadata?.canonical} />
|
|
110
|
-
)}
|
|
115
|
+
{useCanonical && <link rel="canonical" href={pageMetadata?.canonical} />}
|
|
111
116
|
{!!faviconResized && <link rel="icon" href={faviconResized} />}
|
|
112
117
|
|
|
113
118
|
{/* Alternate, solo si se indexa la página y tiene traducciones */}
|
|
114
119
|
{useHrefLangs &&
|
|
115
|
-
cleanPageLanguages
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
))}
|
|
120
|
+
cleanPageLanguages.map(item => (
|
|
121
|
+
<link
|
|
122
|
+
key={item.pageId}
|
|
123
|
+
rel="alternate"
|
|
124
|
+
href={`${item.url}`}
|
|
125
|
+
hreflang={item.locale?.replace(/_/g, '-')}
|
|
126
|
+
/>
|
|
127
|
+
))}
|
|
124
128
|
|
|
125
129
|
{/* Robots */}
|
|
126
|
-
{showMetaRobots &&
|
|
127
|
-
<meta name="robots" content={metaRobots} />
|
|
128
|
-
)}
|
|
130
|
+
{showMetaRobots && <meta name="robots" content={metaRobots} />}
|
|
129
131
|
|
|
130
132
|
{/* Facebook */}
|
|
131
|
-
{!!siteMetadata?.title &&
|
|
133
|
+
{!!siteMetadata?.title && (
|
|
134
|
+
<meta property="og:site_name" content={siteMetadata?.title} />
|
|
135
|
+
)}
|
|
132
136
|
{!!locale && <meta property="og:locale" content={locale} />}
|
|
133
|
-
{(!!openGraph?.title || !!pageMetadata?.title) &&
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
{(!!openGraph?.title || !!pageMetadata?.title) && (
|
|
138
|
+
<meta
|
|
139
|
+
property="og:title"
|
|
140
|
+
content={openGraph?.title || pageMetadata?.title}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
137
143
|
<meta property="og:type" content={openGraph?.type || 'website'} />
|
|
138
|
-
{(!!openGraph?.description || !!pageMetadata?.description) &&
|
|
139
|
-
|
|
144
|
+
{(!!openGraph?.description || !!pageMetadata?.description) && (
|
|
145
|
+
<meta
|
|
146
|
+
property="og:description"
|
|
147
|
+
content={openGraph?.description || pageMetadata?.description}
|
|
148
|
+
/>
|
|
149
|
+
)}
|
|
150
|
+
{!!openGraph?.image && (
|
|
151
|
+
<meta property="og:image" content={openGraph?.image} />
|
|
152
|
+
)}
|
|
140
153
|
<meta property="og:url" content={pageMetadata?.canonical || fullUrl} />
|
|
141
154
|
|
|
142
155
|
{/* Twitter */}
|
|
143
156
|
<meta property="twitter:card" content="summary_large_image" />
|
|
144
|
-
{(!!openGraph?.title || !!pageMetadata?.title) &&
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
{(!!openGraph?.title || !!pageMetadata?.title) && (
|
|
158
|
+
<meta
|
|
159
|
+
property="twitter:title"
|
|
160
|
+
content={openGraph?.title || pageMetadata?.title}
|
|
161
|
+
/>
|
|
162
|
+
)}
|
|
163
|
+
{(!!openGraph?.description || pageMetadata?.description) && (
|
|
164
|
+
<meta
|
|
165
|
+
property="twitter:description"
|
|
166
|
+
content={openGraph?.description || pageMetadata?.description}
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
169
|
+
{(!!openGraph?.twitterImage || !!openGraph?.image) && (
|
|
170
|
+
<meta
|
|
171
|
+
property="twitter:image"
|
|
172
|
+
content={openGraph?.twitterImage || openGraph?.image}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
150
175
|
<meta
|
|
151
176
|
property="twitter:url"
|
|
152
177
|
content={pageMetadata?.canonical || fullUrl}
|
|
153
178
|
/>
|
|
154
|
-
{!siteOptions?.avoidDebugMetas &&
|
|
179
|
+
{!siteOptions?.avoidDebugMetas && (
|
|
180
|
+
<meta
|
|
181
|
+
property="debug"
|
|
182
|
+
content={`Components v${componentsVersion} by Griddo v${griddoVersion} @ ${currentTime}}`}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
155
185
|
|
|
156
186
|
{/* Data Layer */}
|
|
157
187
|
{/* Solo cuando se ejecuta en el navegador */}
|
|
@@ -175,19 +205,21 @@ export const Head = ({ pageContext }) => {
|
|
|
175
205
|
|
|
176
206
|
export default data => {
|
|
177
207
|
const {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
208
|
+
pageContext: {
|
|
209
|
+
page: content,
|
|
210
|
+
locale,
|
|
211
|
+
header,
|
|
212
|
+
footer,
|
|
213
|
+
siteMetadata,
|
|
214
|
+
theme,
|
|
215
|
+
cloudinaryName,
|
|
216
|
+
socials,
|
|
217
|
+
siteLangs,
|
|
218
|
+
BUILD_MODE,
|
|
219
|
+
page: { site: siteId, apiUrl, publicApiUrl, instance },
|
|
220
|
+
sitePages,
|
|
221
|
+
},
|
|
222
|
+
} = data;
|
|
191
223
|
|
|
192
224
|
const library = {
|
|
193
225
|
components,
|
|
@@ -243,4 +275,4 @@ export default data => {
|
|
|
243
275
|
/>
|
|
244
276
|
</SiteProvider>
|
|
245
277
|
);
|
|
246
|
-
};
|
|
278
|
+
};
|
package/src/utils/helpers.js
CHANGED
|
@@ -30,7 +30,7 @@ const formatImage = (image, width, height, format = 'jpg') => {
|
|
|
30
30
|
if (!url) return null;
|
|
31
31
|
return url.split('/')[2].includes('cloudinary.com')
|
|
32
32
|
? addCloudinaryParams(url, `c_fill,w_${width},h_${height}`)
|
|
33
|
-
: addGriddoDamParams(url, `f/${format}/
|
|
33
|
+
: addGriddoDamParams(url, `f/${format}/w/${width}/h/${height}`);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// Format Griddo DAM image
|