@griddo/cx 1.75.40 → 1.75.41

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/utils/pages.js +13 -3
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.40",
4
+ "version": "1.75.41",
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.40",
68
+ "@griddo/eslint-config-back": "^1.75.41",
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": "b6e380b0d181b2203fb246bd1806e95cd341c011"
100
+ "gitHead": "e312be8fcd665ba6446da32c31af02f886029fb5"
101
101
  }
@@ -139,15 +139,25 @@ async function renderListPages(
139
139
  const isFirstPage = idx === 0;
140
140
  const pageNumber = idx + 1;
141
141
  const { domainUrl, compose } = rootPage.fullPath;
142
- const tailPageNumber =
143
- pageNumber > 1 ? `${compose.endsWith('/') ? '' : '/'}${pageNumber}` : ``;
142
+ const addPageNumberToUrl = (url, addEndingSlash = false) =>
143
+ pageNumber > 1
144
+ ? `${url}${url.endsWith('/') ? '' : '/'}${pageNumber}${
145
+ addEndingSlash ? `/` : ''
146
+ }`
147
+ : url;
148
+ const addPageNumberToTitle = title =>
149
+ title && pageNumber > 1 ? `${title} - ${pageNumber}` : title;
144
150
  const paginatedPage = {
145
151
  ...rootPage,
146
152
  fullPath: {
147
153
  ...rootPage.fullPath,
148
154
  // Add a page number (tailPageNumber) from page 2 onwards
149
- compose: `${compose}${tailPageNumber}`,
155
+ compose: addPageNumberToUrl(compose, true),
150
156
  },
157
+ fullUrl: addPageNumberToUrl(rootPage.fullUrl, true),
158
+ slug: addPageNumberToUrl(rootPage.slug, false),
159
+ title: addPageNumberToTitle(rootPage.title),
160
+ metaTitle: addPageNumberToTitle(rootPage.metaTitle),
151
161
  template: {
152
162
  ...distributorTemplate,
153
163
  isFirstPage,