@prezly/theme-kit-nextjs 1.10.3-2 → 1.11.0
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/README.md +5 -5
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js +2 -2
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +2 -2
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +1 -1
- package/src/adapter-nextjs/api-handlers/fetchStories.ts +1 -1
package/README.md
CHANGED
|
@@ -235,24 +235,24 @@ This kit can also help you with building your Sitemap automatically. Here's what
|
|
|
235
235
|
1. Create a sitemap page file: `/pages/sitemap.xml.ts`
|
|
236
236
|
2. Use this code to display the default Sitemap built with your Newsroom stories:
|
|
237
237
|
```ts
|
|
238
|
+
import { getSitemapServerSideProps } from '@prezly/theme-kit-nextjs';
|
|
238
239
|
import type { NextPage } from 'next';
|
|
239
|
-
import { getSitemapInitialProps } from '@prezly/theme-kit-nextjs';
|
|
240
240
|
|
|
241
241
|
const Sitemap: NextPage = () => null;
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
export const getServerSideProps = getSitemapServerSideProps();
|
|
244
244
|
|
|
245
245
|
export default Sitemap;
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
You can also add additional paths to the sitemap by passing them as
|
|
248
|
+
You can also add additional paths to the sitemap by passing them as an argument to `getSitemapServerSideProps`, like so:
|
|
249
249
|
```ts
|
|
250
250
|
const additionalPaths = ['/my-custom-path'];
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
export const getServerSideProps = getSitemapServerSideProps(additionalPaths);
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
If you need a more customized approach, you can build your own Sitemap by extending the `SitemapBuilder` class exported from the library, as well as referring to the code in the [Sitemap](./tree/main/src/
|
|
255
|
+
If you need a more customized approach, you can build your own Sitemap by extending the `SitemapBuilder` class exported from the library, as well as referring to the code in the [Sitemap](./tree/main/src/adapter-nextjs/page-props/sitemap) component directory.
|
|
256
256
|
|
|
257
257
|
----
|
|
258
258
|
|
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.fetchGalleries = void 0;
|
|
40
|
-
var
|
|
40
|
+
var data_fetching_1 = require("../../data-fetching");
|
|
41
41
|
function fetchGalleries(req, res) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
43
|
var _a, page, pageSize, api, galleries, error_1;
|
|
@@ -52,7 +52,7 @@ function fetchGalleries(req, res) {
|
|
|
52
52
|
_b.label = 1;
|
|
53
53
|
case 1:
|
|
54
54
|
_b.trys.push([1, 3, , 4]);
|
|
55
|
-
api = (0,
|
|
55
|
+
api = (0, data_fetching_1.getPrezlyApi)(req);
|
|
56
56
|
return [4 /*yield*/, api.getGalleries({ page: page, pageSize: pageSize })];
|
|
57
57
|
case 2:
|
|
58
58
|
galleries = (_b.sent()).galleries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchGalleries.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchGalleries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA
|
|
1
|
+
{"version":3,"file":"fetchGalleries.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchGalleries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAmD;AAEnD,SAAsB,cAAc,CAAC,GAAmB,EAAE,GAAoB;;;;;;oBAC1E,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;wBACvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAChB,sBAAO;qBACV;oBAEK,KAAqB,GAAG,CAAC,IAAI,EAA3B,IAAI,UAAA,EAAE,QAAQ,cAAA,CAAc;;;;oBAG1B,GAAG,GAAG,IAAA,4BAAY,EAAC,GAAG,CAAC,CAAC;oBAER,qBAAM,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,EAAA;;oBAAxD,SAAS,GAAK,CAAA,SAA0C,CAAA,UAA/C;oBAEjB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;;;;oBAEpC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACjB,OAAO,EAAG,OAAe,CAAC,OAAO;qBACpC,CAAC,CAAC;;;;;;CAEV;AAnBD,wCAmBC"}
|
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.fetchStories = void 0;
|
|
40
|
-
var
|
|
40
|
+
var data_fetching_1 = require("../../data-fetching");
|
|
41
41
|
function fetchStories(req, res) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
43
|
var _a, page, pageSize, category, include, localeCode, api, stories, error_1;
|
|
@@ -52,7 +52,7 @@ function fetchStories(req, res) {
|
|
|
52
52
|
_b.label = 1;
|
|
53
53
|
case 1:
|
|
54
54
|
_b.trys.push([1, 3, , 4]);
|
|
55
|
-
api = (0,
|
|
55
|
+
api = (0, data_fetching_1.getPrezlyApi)(req);
|
|
56
56
|
return [4 /*yield*/, (category
|
|
57
57
|
? api.getStoriesFromCategory(category, { page: page, pageSize: pageSize, include: include, localeCode: localeCode })
|
|
58
58
|
: api.getStories({ page: page, pageSize: pageSize, include: include, localeCode: localeCode }))];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchStories.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchStories.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA
|
|
1
|
+
{"version":3,"file":"fetchStories.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchStories.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAmD;AAEnD,SAAsB,YAAY,CAAC,GAAmB,EAAE,GAAoB;;;;;;oBACxE,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;wBACvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAChB,sBAAO;qBACV;oBAEK,KAAoD,GAAG,CAAC,IAAI,EAA1D,IAAI,UAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,UAAU,gBAAA,CAAc;;;;oBAGzD,GAAG,GAAG,IAAA,4BAAY,EAAC,GAAG,CAAC,CAAC;oBAEV,qBAAM,CAAC,QAAQ;4BAC/B,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,IAAI,MAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,CAAC;4BAC/E,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,IAAI,MAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC,EAAA;;oBAFtD,OAAO,GAAK,CAAA,SAE0C,CAAA,QAF/C;oBAIf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;;;;oBAElC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACjB,OAAO,EAAG,OAAe,CAAC,OAAO;qBACpC,CAAC,CAAC;;;;;;CAEV;AArBD,oCAqBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-nextjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Data layer and utility library for developing Prezly themes with NextJS",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@prezly/sdk": "^6.24.0",
|
|
52
|
-
"@react-hookz/web": "^
|
|
52
|
+
"@react-hookz/web": "^14.2.2",
|
|
53
53
|
"next-seo": "^5.4.0",
|
|
54
54
|
"parse-data-url": "^4.0.1"
|
|
55
55
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
2
|
|
|
3
|
-
import { getPrezlyApi } from '../../data-fetching
|
|
3
|
+
import { getPrezlyApi } from '../../data-fetching';
|
|
4
4
|
|
|
5
5
|
export async function fetchGalleries(req: NextApiRequest, res: NextApiResponse) {
|
|
6
6
|
if (req.method !== 'POST') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
2
|
|
|
3
|
-
import { getPrezlyApi } from '../../data-fetching
|
|
3
|
+
import { getPrezlyApi } from '../../data-fetching';
|
|
4
4
|
|
|
5
5
|
export async function fetchStories(req: NextApiRequest, res: NextApiResponse) {
|
|
6
6
|
if (req.method !== 'POST') {
|