@griddo/cx 1.57.21 → 1.58.2
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/services/robots.js +4 -1
- package/src/services/sites.js +1 -1
- package/src/utils/pages.js +7 -6
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.
|
|
4
|
+
"version": "1.58.2",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"react-helmet": "^6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@griddo/eslint-config-back": "^1.
|
|
69
|
+
"@griddo/eslint-config-back": "^1.58.2",
|
|
70
70
|
"eslint": "^7.5.0",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
|
72
72
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "bd566be3f07f7e7ca673a2dd599d7f7abfdf3783"
|
|
102
102
|
}
|
package/src/services/robots.js
CHANGED
|
@@ -14,7 +14,10 @@ class RobotsService {
|
|
|
14
14
|
async loadRobots() {
|
|
15
15
|
try {
|
|
16
16
|
const apiRobots = await api.get(this.ENDPOINT);
|
|
17
|
-
this.robots = apiRobots.filter(r => !!r.path
|
|
17
|
+
this.robots = apiRobots.filter(r => !!r.path).map(({ path, content }) => ({
|
|
18
|
+
path,
|
|
19
|
+
content: content || 'User-agent: *\n\r\n\rAllow: /'
|
|
20
|
+
})) || [];
|
|
18
21
|
} catch (e) {
|
|
19
22
|
helpers.log('error', `${this.constructor.name}: ${e.message}`);
|
|
20
23
|
}
|
package/src/services/sites.js
CHANGED
|
@@ -13,7 +13,7 @@ const ENDPOINTS = {
|
|
|
13
13
|
GET_DISTRIBUTOR_DATA: [`${withURI}`, '/distributor'],
|
|
14
14
|
GET_SITEMAP: [`${withURI}`, '/sitemap'],
|
|
15
15
|
SOCIALS: [`${withURI}`, '/socials'],
|
|
16
|
-
GET_PAGES: [`${withURI}`, '/pages'],
|
|
16
|
+
GET_PAGES: [`${withURI}`, '/pages?pagination=false'],
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
class SitesService {
|
package/src/utils/pages.js
CHANGED
|
@@ -128,7 +128,8 @@ async function renderListPages(
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
async function renderMultiplePages(page, additionalInfo, createPage) {
|
|
131
|
-
const { multiPageElements, ...cleanPage } = page;
|
|
131
|
+
const { multiPageElements: multiPageElementsBulk, ...cleanPage } = page;
|
|
132
|
+
const multiPageElements = JSON.parse(JSON.stringify(multiPageElementsBulk));
|
|
132
133
|
|
|
133
134
|
// si no hay un elemento sin slug, como mínimo hay que dibujar una página principal para el conjunto de páginas
|
|
134
135
|
if (!multiPageElements.find(({ sectionSlug }) => sectionSlug === '/'))
|
|
@@ -139,25 +140,25 @@ async function renderMultiplePages(page, additionalInfo, createPage) {
|
|
|
139
140
|
const paginatedPage = JSON.parse(JSON.stringify(cleanPage));
|
|
140
141
|
const {
|
|
141
142
|
sectionSlug = '/',
|
|
142
|
-
title = '',
|
|
143
|
+
title: bulkTitle = '',
|
|
143
144
|
metaTitle = '',
|
|
144
145
|
metaDescription = '',
|
|
145
146
|
} = pageElement;
|
|
147
|
+
const title = bulkTitle.content || bulkTitle;
|
|
146
148
|
const compose = paginatedPage?.fullPath?.compose || '';
|
|
147
149
|
const fullUrl = paginatedPage.fullUrl.endsWith('/')
|
|
148
150
|
? paginatedPage.fullUrl.slice(0, -1)
|
|
149
151
|
: paginatedPage.fullUrl;
|
|
150
152
|
const rightSectionSlug = sectionSlug?.replace(/\//g, '');
|
|
151
|
-
const newCompose = `${compose}${
|
|
152
|
-
|
|
153
|
-
}${rightSectionSlug}`;
|
|
153
|
+
const newCompose = `${compose}${compose.endsWith('/') ? '' : '/'
|
|
154
|
+
}${rightSectionSlug}`;
|
|
154
155
|
paginatedPage.fullUrl = `${fullUrl}/${rightSectionSlug}`;
|
|
155
156
|
paginatedPage.fullPath.compose = newCompose;
|
|
156
157
|
paginatedPage.slug = newCompose;
|
|
157
158
|
paginatedPage.template.activeSectionSlug = sectionSlug;
|
|
158
159
|
paginatedPage.template.activeSectionBase = fullUrl;
|
|
159
160
|
if (title.trim()) paginatedPage.title = title;
|
|
160
|
-
|
|
161
|
+
paginatedPage.metaTitle = metaTitle.trim() || title.trim() || paginatedPage.metaTitle;
|
|
161
162
|
if (metaDescription.trim()) paginatedPage.metaDescription = metaDescription;
|
|
162
163
|
await renderSinglePage(paginatedPage, additionalInfo, createPage);
|
|
163
164
|
}
|