@prezly/theme-kit-nextjs 7.0.1 → 8.0.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/build/adapters/app-helper/server.cjs +29 -0
- package/build/adapters/app-helper/server.d.ts +9 -0
- package/build/adapters/app-helper/server.mjs +23 -0
- package/build/adapters/client.cjs +27 -0
- package/build/adapters/client.d.ts +2 -0
- package/build/adapters/client.mjs +3 -0
- package/build/adapters/intl/server.cjs +108 -0
- package/build/adapters/intl/server.d.ts +26 -0
- package/build/adapters/intl/server.mjs +100 -0
- package/build/adapters/metadata/lib/generateCategoryPageMetadata.cjs +52 -0
- package/build/adapters/metadata/lib/generateCategoryPageMetadata.d.ts +12 -0
- package/build/adapters/metadata/lib/generateCategoryPageMetadata.mjs +46 -0
- package/build/adapters/metadata/lib/generateMediaGalleryPageMetadata.cjs +44 -0
- package/build/adapters/metadata/lib/generateMediaGalleryPageMetadata.d.ts +12 -0
- package/build/adapters/metadata/lib/generateMediaGalleryPageMetadata.mjs +38 -0
- package/build/adapters/metadata/lib/generateMediaPageMetadata.cjs +43 -0
- package/build/adapters/metadata/lib/generateMediaPageMetadata.d.ts +12 -0
- package/build/adapters/metadata/lib/generateMediaPageMetadata.mjs +37 -0
- package/build/adapters/metadata/lib/generateRootMetadata.cjs +51 -0
- package/build/adapters/metadata/lib/generateRootMetadata.d.ts +10 -0
- package/build/adapters/metadata/lib/generateRootMetadata.mjs +45 -0
- package/build/adapters/metadata/lib/generateSearchPageMetadata.cjs +43 -0
- package/build/adapters/metadata/lib/generateSearchPageMetadata.d.ts +12 -0
- package/build/adapters/metadata/lib/generateSearchPageMetadata.mjs +37 -0
- package/build/adapters/metadata/lib/generateStoryPageMetadata.cjs +100 -0
- package/build/adapters/metadata/lib/generateStoryPageMetadata.d.ts +14 -0
- package/build/adapters/metadata/lib/generateStoryPageMetadata.mjs +94 -0
- package/build/adapters/metadata/lib/index.cjs +66 -0
- package/build/adapters/metadata/lib/index.d.ts +8 -0
- package/build/adapters/metadata/lib/index.mjs +7 -0
- package/build/adapters/metadata/lib/types.cjs +1 -0
- package/build/adapters/metadata/lib/types.d.ts +30 -0
- package/build/adapters/metadata/lib/types.mjs +1 -0
- package/build/adapters/metadata/lib/utils/generateAlternateLanguageLinks.cjs +11 -0
- package/build/adapters/metadata/lib/utils/generateAlternateLanguageLinks.d.ts +7 -0
- package/build/adapters/metadata/lib/utils/generateAlternateLanguageLinks.mjs +5 -0
- package/build/adapters/metadata/lib/utils/generatePageMetadata.cjs +75 -0
- package/build/adapters/metadata/lib/utils/generatePageMetadata.d.ts +14 -0
- package/build/adapters/metadata/lib/utils/generatePageMetadata.mjs +70 -0
- package/build/adapters/metadata/lib/utils/index.cjs +26 -0
- package/build/adapters/metadata/lib/utils/index.d.ts +3 -0
- package/build/adapters/metadata/lib/utils/index.mjs +3 -0
- package/build/adapters/metadata/lib/utils/mergePageMetadata.cjs +48 -0
- package/build/adapters/metadata/lib/utils/mergePageMetadata.d.ts +2 -0
- package/build/adapters/metadata/lib/utils/mergePageMetadata.mjs +43 -0
- package/build/adapters/metadata/server.cjs +82 -0
- package/build/adapters/metadata/server.d.ts +34 -0
- package/build/adapters/metadata/server.mjs +74 -0
- package/build/adapters/prezly/cache/configure.cjs +38 -0
- package/build/adapters/prezly/cache/configure.d.ts +15 -0
- package/build/adapters/prezly/cache/configure.mjs +33 -0
- package/build/adapters/prezly/cache/index.cjs +19 -0
- package/build/adapters/prezly/cache/index.d.ts +2 -0
- package/build/adapters/prezly/cache/index.mjs +2 -0
- package/build/adapters/prezly/cache/redis.cjs +60 -0
- package/build/adapters/prezly/cache/redis.d.ts +9 -0
- package/build/adapters/prezly/cache/redis.mjs +55 -0
- package/build/adapters/prezly/server.cjs +55 -0
- package/build/adapters/prezly/server.d.ts +48 -0
- package/build/adapters/prezly/server.mjs +51 -0
- package/build/adapters/routing/client.cjs +10 -0
- package/build/adapters/routing/client.d.ts +1 -0
- package/build/adapters/routing/client.mjs +3 -0
- package/build/adapters/routing/lib/RoutingAdapter.client.cjs +55 -0
- package/build/adapters/routing/lib/RoutingAdapter.client.d.ts +39 -0
- package/build/adapters/routing/lib/RoutingAdapter.client.mjs +48 -0
- package/build/adapters/routing/lib/RoutingAdapter.server.cjs +49 -0
- package/build/adapters/routing/lib/RoutingAdapter.server.d.ts +16 -0
- package/build/adapters/routing/lib/RoutingAdapter.server.mjs +45 -0
- package/build/adapters/routing/server.cjs +29 -0
- package/build/adapters/routing/server.d.ts +2 -0
- package/build/adapters/routing/server.mjs +5 -0
- package/build/adapters/server.cjs +71 -0
- package/build/adapters/server.d.ts +6 -0
- package/build/adapters/server.mjs +7 -0
- package/build/adapters/theme-settings/client.cjs +37 -0
- package/build/adapters/theme-settings/client.d.ts +13 -0
- package/build/adapters/theme-settings/client.mjs +30 -0
- package/build/adapters/theme-settings/server.cjs +34 -0
- package/build/adapters/theme-settings/server.d.ts +10 -0
- package/build/adapters/theme-settings/server.mjs +28 -0
- package/build/index.cjs +49 -0
- package/build/index.d.ts +4 -7
- package/build/index.mjs +4 -0
- package/build/middleware/generate-slugs.d.ts +1 -0
- package/build/middleware/index.cjs +10 -0
- package/build/middleware/index.d.ts +1 -0
- package/build/middleware/index.mjs +2 -0
- package/build/middleware/intl-middleware.cjs +134 -0
- package/build/middleware/intl-middleware.d.ts +101 -0
- package/build/middleware/intl-middleware.mjs +127 -0
- package/build/middleware/slugs.cjs +9 -0
- package/build/middleware/slugs.d.ts +1 -0
- package/build/middleware/slugs.mjs +3 -0
- package/build/next-config/index.cjs +63 -0
- package/build/next-config/index.d.ts +9 -0
- package/build/next-config/index.mjs +57 -0
- package/build/playwright/config.cjs +70 -0
- package/build/playwright/config.d.ts +7 -1
- package/build/playwright/config.mjs +66 -0
- package/build/playwright/index.cjs +12 -0
- package/build/playwright/index.d.ts +1 -1
- package/build/playwright/index.mjs +1 -0
- package/build/robots/server.cjs +54 -0
- package/build/robots/server.d.ts +12 -0
- package/build/robots/server.mjs +48 -0
- package/build/sentry/client.cjs +10 -0
- package/build/sentry/client.d.ts +1 -2
- package/build/sentry/client.mjs +4 -0
- package/build/sentry/common.cjs +72 -0
- package/build/sentry/common.d.ts +1 -1
- package/build/sentry/common.mjs +66 -0
- package/build/sentry/index.cjs +19 -0
- package/build/sentry/index.d.ts +2 -2
- package/build/sentry/index.mjs +2 -0
- package/build/sentry/server.cjs +10 -0
- package/build/sentry/server.d.ts +1 -2
- package/build/sentry/server.mjs +4 -0
- package/build/server.cjs +25 -0
- package/build/server.d.ts +2 -2
- package/build/server.mjs +3 -0
- package/package.json +51 -26
- package/build/adapter-nextjs/api-handlers/fetchGalleries.d.ts +0 -2
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js +0 -29
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +0 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.d.ts +0 -2
- package/build/adapter-nextjs/api-handlers/fetchStories.js +0 -34
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +0 -1
- package/build/adapter-nextjs/api-handlers/index.d.ts +0 -2
- package/build/adapter-nextjs/api-handlers/index.js +0 -8
- package/build/adapter-nextjs/api-handlers/index.js.map +0 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.d.ts +0 -16
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +0 -18
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +0 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.d.ts +0 -16
- package/build/adapter-nextjs/getNewsroomStaticProps.js +0 -18
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +0 -1
- package/build/adapter-nextjs/index.d.ts +0 -6
- package/build/adapter-nextjs/index.js +0 -23
- package/build/adapter-nextjs/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/category.d.ts +0 -16
- package/build/adapter-nextjs/page-props/category.js +0 -105
- package/build/adapter-nextjs/page-props/category.js.map +0 -1
- package/build/adapter-nextjs/page-props/gallery.d.ts +0 -14
- package/build/adapter-nextjs/page-props/gallery.js +0 -74
- package/build/adapter-nextjs/page-props/gallery.js.map +0 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.d.ts +0 -9
- package/build/adapter-nextjs/page-props/galleryAlbum.js +0 -56
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +0 -1
- package/build/adapter-nextjs/page-props/home.d.ts +0 -21
- package/build/adapter-nextjs/page-props/home.js +0 -73
- package/build/adapter-nextjs/page-props/home.js.map +0 -1
- package/build/adapter-nextjs/page-props/index.d.ts +0 -8
- package/build/adapter-nextjs/page-props/index.js +0 -42
- package/build/adapter-nextjs/page-props/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/lib/types.d.ts +0 -3
- package/build/adapter-nextjs/page-props/lib/types.js +0 -3
- package/build/adapter-nextjs/page-props/lib/types.js.map +0 -1
- package/build/adapter-nextjs/page-props/search.d.ts +0 -4
- package/build/adapter-nextjs/page-props/search.js +0 -32
- package/build/adapter-nextjs/page-props/search.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.d.ts +0 -22
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +0 -139
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.d.ts +0 -7
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +0 -55
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/index.d.ts +0 -3
- package/build/adapter-nextjs/page-props/sitemap/index.js +0 -23
- package/build/adapter-nextjs/page-props/sitemap/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/types.d.ts +0 -9
- package/build/adapter-nextjs/page-props/sitemap/types.js +0 -3
- package/build/adapter-nextjs/page-props/sitemap/types.js.map +0 -1
- package/build/adapter-nextjs/page-props/story.d.ts +0 -13
- package/build/adapter-nextjs/page-props/story.js +0 -78
- package/build/adapter-nextjs/page-props/story.js.map +0 -1
- package/build/adapter-nextjs/page-props/storyPreview.d.ts +0 -4
- package/build/adapter-nextjs/page-props/storyPreview.js +0 -28
- package/build/adapter-nextjs/page-props/storyPreview.js.map +0 -1
- package/build/adapter-nextjs/processRequest.d.ts +0 -12
- package/build/adapter-nextjs/processRequest.js +0 -43
- package/build/adapter-nextjs/processRequest.js.map +0 -1
- package/build/adapter-nextjs/processStaticRequest.d.ts +0 -11
- package/build/adapter-nextjs/processStaticRequest.js +0 -28
- package/build/adapter-nextjs/processStaticRequest.js.map +0 -1
- package/build/components-nextjs/PageSeo/PageSeo.d.ts +0 -16
- package/build/components-nextjs/PageSeo/PageSeo.js +0 -87
- package/build/components-nextjs/PageSeo/PageSeo.js.map +0 -1
- package/build/components-nextjs/PageSeo/index.d.ts +0 -1
- package/build/components-nextjs/PageSeo/index.js +0 -6
- package/build/components-nextjs/PageSeo/index.js.map +0 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.d.ts +0 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +0 -14
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +0 -1
- package/build/components-nextjs/PageSeo/lib/index.d.ts +0 -1
- package/build/components-nextjs/PageSeo/lib/index.js +0 -6
- package/build/components-nextjs/PageSeo/lib/index.js.map +0 -1
- package/build/components-nextjs/StorySeo/StorySeo.d.ts +0 -11
- package/build/components-nextjs/StorySeo/StorySeo.js +0 -56
- package/build/components-nextjs/StorySeo/StorySeo.js.map +0 -1
- package/build/components-nextjs/StorySeo/index.d.ts +0 -1
- package/build/components-nextjs/StorySeo/index.js +0 -6
- package/build/components-nextjs/StorySeo/index.js.map +0 -1
- package/build/components-nextjs/document.d.ts +0 -5
- package/build/components-nextjs/document.js +0 -48
- package/build/components-nextjs/document.js.map +0 -1
- package/build/components-nextjs/index.d.ts +0 -3
- package/build/components-nextjs/index.js +0 -10
- package/build/components-nextjs/index.js.map +0 -1
- package/build/config.d.ts +0 -17
- package/build/config.js +0 -78
- package/build/config.js.map +0 -1
- package/build/data-fetching/client.d.ts +0 -10
- package/build/data-fetching/client.js +0 -51
- package/build/data-fetching/client.js.map +0 -1
- package/build/data-fetching/index.d.ts +0 -1
- package/build/data-fetching/index.js +0 -28
- package/build/data-fetching/index.js.map +0 -1
- package/build/index.js +0 -24
- package/build/index.js.map +0 -1
- package/build/infinite-loading/index.d.ts +0 -4
- package/build/infinite-loading/index.js +0 -25
- package/build/infinite-loading/index.js.map +0 -1
- package/build/infinite-loading/lib/index.d.ts +0 -1
- package/build/infinite-loading/lib/index.js +0 -6
- package/build/infinite-loading/lib/index.js.map +0 -1
- package/build/infinite-loading/lib/useAsync.d.ts +0 -44
- package/build/infinite-loading/lib/useAsync.js +0 -70
- package/build/infinite-loading/lib/useAsync.js.map +0 -1
- package/build/infinite-loading/lib/useSyncedRef.d.ts +0 -12
- package/build/infinite-loading/lib/useSyncedRef.js +0 -24
- package/build/infinite-loading/lib/useSyncedRef.js.map +0 -1
- package/build/infinite-loading/types.d.ts +0 -9
- package/build/infinite-loading/types.js +0 -3
- package/build/infinite-loading/types.js.map +0 -1
- package/build/infinite-loading/useInfiniteGalleriesLoading.d.ts +0 -13
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +0 -46
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +0 -1
- package/build/infinite-loading/useInfiniteLoading.d.ts +0 -16
- package/build/infinite-loading/useInfiniteLoading.js +0 -44
- package/build/infinite-loading/useInfiniteLoading.js.map +0 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.d.ts +0 -13
- package/build/infinite-loading/useInfiniteStoriesLoading.js +0 -62
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +0 -1
- package/build/intl/index.d.ts +0 -2
- package/build/intl/index.js +0 -19
- package/build/intl/index.js.map +0 -1
- package/build/intl/languages.d.ts +0 -6
- package/build/intl/languages.js +0 -19
- package/build/intl/languages.js.map +0 -1
- package/build/intl/locale.d.ts +0 -5
- package/build/intl/locale.js +0 -31
- package/build/intl/locale.js.map +0 -1
- package/build/newsroom-context/context.d.ts +0 -62
- package/build/newsroom-context/context.js +0 -29
- package/build/newsroom-context/context.js.map +0 -1
- package/build/newsroom-context/hooks/index.d.ts +0 -11
- package/build/newsroom-context/hooks/index.js +0 -28
- package/build/newsroom-context/hooks/index.js.map +0 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.d.ts +0 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +0 -10
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +0 -1
- package/build/newsroom-context/hooks/useCategories.d.ts +0 -1
- package/build/newsroom-context/hooks/useCategories.js +0 -10
- package/build/newsroom-context/hooks/useCategories.js.map +0 -1
- package/build/newsroom-context/hooks/useCompanyInformation.d.ts +0 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +0 -10
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentCategory.d.ts +0 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js +0 -10
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentLocale.d.ts +0 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +0 -10
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentStory.d.ts +0 -1
- package/build/newsroom-context/hooks/useCurrentStory.js +0 -10
- package/build/newsroom-context/hooks/useCurrentStory.js.map +0 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.d.ts +0 -2
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +0 -29
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +0 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.d.ts +0 -6
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +0 -65
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +0 -1
- package/build/newsroom-context/hooks/useLanguages.d.ts +0 -1
- package/build/newsroom-context/hooks/useLanguages.js +0 -10
- package/build/newsroom-context/hooks/useLanguages.js.map +0 -1
- package/build/newsroom-context/hooks/useNewsroom.d.ts +0 -1
- package/build/newsroom-context/hooks/useNewsroom.js +0 -10
- package/build/newsroom-context/hooks/useNewsroom.js.map +0 -1
- package/build/newsroom-context/hooks/useNewsroomContext.d.ts +0 -2
- package/build/newsroom-context/hooks/useNewsroomContext.js +0 -16
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +0 -1
- package/build/newsroom-context/index.d.ts +0 -2
- package/build/newsroom-context/index.js +0 -22
- package/build/newsroom-context/index.js.map +0 -1
- package/build/playwright/config.js +0 -67
- package/build/playwright/config.js.map +0 -1
- package/build/playwright/index.js +0 -6
- package/build/playwright/index.js.map +0 -1
- package/build/sentry/client.js +0 -9
- package/build/sentry/client.js.map +0 -1
- package/build/sentry/common.js +0 -66
- package/build/sentry/common.js.map +0 -1
- package/build/sentry/index.js +0 -8
- package/build/sentry/index.js.map +0 -1
- package/build/sentry/server.js +0 -9
- package/build/sentry/server.js.map +0 -1
- package/build/server.js +0 -19
- package/build/server.js.map +0 -1
- package/build/types.d.ts +0 -14
- package/build/types.js +0 -3
- package/build/types.js.map +0 -1
- package/build/utils.d.ts +0 -6
- package/build/utils.js +0 -16
- package/build/utils.js.map +0 -1
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SitemapBuilder = void 0;
|
|
4
|
-
const sdk_1 = require("@prezly/sdk");
|
|
5
|
-
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
6
|
-
class SitemapBuilder {
|
|
7
|
-
baseUrl;
|
|
8
|
-
basePath;
|
|
9
|
-
usedLanguages;
|
|
10
|
-
urls = [];
|
|
11
|
-
constructor(baseUrl, basePath, languages) {
|
|
12
|
-
this.baseUrl = baseUrl;
|
|
13
|
-
this.basePath = basePath;
|
|
14
|
-
// Sort languages to place the default language first
|
|
15
|
-
this.usedLanguages = (0, theme_kit_core_1.getUsedLanguages)(languages).sort((a, b) => {
|
|
16
|
-
if (a.is_default)
|
|
17
|
-
return -1;
|
|
18
|
-
if (b.is_default)
|
|
19
|
-
return 1;
|
|
20
|
-
return 0;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
buildUrl(location, localeCode) {
|
|
24
|
-
const shortestLocaleCode = localeCode
|
|
25
|
-
? (0, theme_kit_core_1.getShortestLocaleCode)(this.usedLanguages, theme_kit_core_1.LocaleObject.fromAnyCode(localeCode))
|
|
26
|
-
: false;
|
|
27
|
-
const basePart = this.basePath ?? '';
|
|
28
|
-
const localePart = shortestLocaleCode
|
|
29
|
-
? `/${theme_kit_core_1.LocaleObject.fromAnyCode(shortestLocaleCode).toUrlSlug()}`
|
|
30
|
-
: '';
|
|
31
|
-
const finalPart = (basePart || localePart) && location === '/' ? '' : location;
|
|
32
|
-
return this.baseUrl + basePart + localePart + finalPart;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Add a non-dynamic URL to the sitemap (e.g. `/` or `/media`)
|
|
36
|
-
* The URL will be added once for each used locale on the site, with proper locale code part.
|
|
37
|
-
*/
|
|
38
|
-
addPageUrl(url) {
|
|
39
|
-
this.usedLanguages.forEach(({ code }) => {
|
|
40
|
-
this.urls.push({
|
|
41
|
-
location: this.buildUrl(url, code),
|
|
42
|
-
changeFrequency: SitemapBuilder.guessFrequency(url),
|
|
43
|
-
priority: SitemapBuilder.guessPriority(url),
|
|
44
|
-
alternateLinks: this.usedLanguages.map((language) => ({
|
|
45
|
-
href: this.buildUrl(url, language.code),
|
|
46
|
-
lang: theme_kit_core_1.LocaleObject.fromAnyCode(language.code).toUrlSlug(),
|
|
47
|
-
})),
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
addStoryUrl(story) {
|
|
52
|
-
const url = `/${story.slug}`;
|
|
53
|
-
// De-dupe translations and only include locales that are enabled on the site
|
|
54
|
-
const translationsMap = story.translations.reduce((map, translation) => {
|
|
55
|
-
if (this.usedLanguages.some(({ code }) => code === translation.culture.code) &&
|
|
56
|
-
translation.status === 'published') {
|
|
57
|
-
map.set(translation.culture.code, translation);
|
|
58
|
-
}
|
|
59
|
-
return map;
|
|
60
|
-
}, new Map());
|
|
61
|
-
// Include the original story to display it in alternate links
|
|
62
|
-
translationsMap.set(story.culture.code, story);
|
|
63
|
-
const translations = Array.from(translationsMap.values());
|
|
64
|
-
this.urls.push({
|
|
65
|
-
location: this.buildUrl(`/${story.slug}`),
|
|
66
|
-
changeFrequency: SitemapBuilder.guessFrequency(url),
|
|
67
|
-
priority: SitemapBuilder.guessPriority(url),
|
|
68
|
-
...(translations.length > 1 && {
|
|
69
|
-
alternateLinks: translations.map((translatedStory) => ({
|
|
70
|
-
href: this.buildUrl(`/${translatedStory.slug}`),
|
|
71
|
-
lang: theme_kit_core_1.LocaleObject.fromAnyCode(translatedStory.culture.code).toUrlSlug(),
|
|
72
|
-
})),
|
|
73
|
-
}),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
addCategoryUrl(category) {
|
|
77
|
-
// De-dupe translations and only include locales that are enabled on the site
|
|
78
|
-
const translationsMap = Object.values(category.i18n).reduce((map, translation) => {
|
|
79
|
-
if (this.usedLanguages.some(({ code }) => code === translation.locale.code)) {
|
|
80
|
-
map.set(translation.locale.code, translation);
|
|
81
|
-
}
|
|
82
|
-
return map;
|
|
83
|
-
}, new Map());
|
|
84
|
-
const translations = Array.from(translationsMap.values());
|
|
85
|
-
this.usedLanguages.forEach(({ code }) => {
|
|
86
|
-
const translatedCategory = sdk_1.Category.translation(category, code);
|
|
87
|
-
if (translatedCategory) {
|
|
88
|
-
const url = `/category/${translatedCategory.slug}`;
|
|
89
|
-
this.urls.push({
|
|
90
|
-
location: this.buildUrl(url, code),
|
|
91
|
-
changeFrequency: SitemapBuilder.guessFrequency(url),
|
|
92
|
-
priority: SitemapBuilder.guessPriority(url),
|
|
93
|
-
...(translations.length > 1 && {
|
|
94
|
-
alternateLinks: translations.map((translation) => ({
|
|
95
|
-
href: this.buildUrl(`/category/${translation.slug}`, translation.locale.code),
|
|
96
|
-
lang: theme_kit_core_1.LocaleObject.fromAnyCode(translation.locale.code).toUrlSlug(),
|
|
97
|
-
})),
|
|
98
|
-
}),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
// TODO: Allow specyfying changeFrequency and priority externally
|
|
104
|
-
static guessFrequency(location) {
|
|
105
|
-
if (location === '/')
|
|
106
|
-
return 'daily';
|
|
107
|
-
return 'weekly';
|
|
108
|
-
}
|
|
109
|
-
static guessPriority(location) {
|
|
110
|
-
if (location === '/')
|
|
111
|
-
return '0.9';
|
|
112
|
-
if (location.startsWith('/category/')) {
|
|
113
|
-
return '0.8';
|
|
114
|
-
}
|
|
115
|
-
return '0.7';
|
|
116
|
-
}
|
|
117
|
-
static serializeLocation(url) {
|
|
118
|
-
return [
|
|
119
|
-
'<url>',
|
|
120
|
-
url.location && `\t<loc>${url.location}</loc>`,
|
|
121
|
-
url.changeFrequency && `\t<changefreq>${url.changeFrequency}</changefreq>`,
|
|
122
|
-
url.priority && `\t<priority>${url.priority}</priority>`,
|
|
123
|
-
url.alternateLinks?.map(({ lang, href }) => `\t<xhtml:link rel="alternate" hreflang="${lang}" href="${href}"/>`),
|
|
124
|
-
'</url>',
|
|
125
|
-
]
|
|
126
|
-
.filter(Boolean)
|
|
127
|
-
.join('\n');
|
|
128
|
-
}
|
|
129
|
-
serialize() {
|
|
130
|
-
return [
|
|
131
|
-
'<?xml version="1.0" encoding="UTF-8" ?>',
|
|
132
|
-
'<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.w3.org/TR/xhtml11/xhtml11_schema.html http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html">',
|
|
133
|
-
this.urls.map(SitemapBuilder.serializeLocation).join('\n'),
|
|
134
|
-
'</urlset>',
|
|
135
|
-
].join('\n');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.SitemapBuilder = SitemapBuilder;
|
|
139
|
-
//# sourceMappingURL=SitemapBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SitemapBuilder.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,2DAA+F;AAI/F,MAAa,cAAc;IACf,OAAO,CAAS;IAEhB,QAAQ,CAAqB;IAE7B,aAAa,CAA6B;IAE1C,IAAI,GAAiB,EAAE,CAAC;IAEhC,YACI,OAAe,EACf,QAA4B,EAC5B,SAAqC;QAErC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,qDAAqD;QACrD,IAAI,CAAC,aAAa,GAAG,IAAA,iCAAgB,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAC3D,IAAI,CAAC,CAAC,UAAU;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC5B,IAAI,CAAC,CAAC,UAAU;gBAAE,OAAO,CAAC,CAAC;YAC3B,OAAO,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAClD,MAAM,kBAAkB,GAAG,UAAU;YACjC,CAAC,CAAC,IAAA,sCAAqB,EAAC,IAAI,CAAC,aAAa,EAAE,6BAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YACjF,CAAC,C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AiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1D,WAAW;SACd,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;CACJ;AAjKD,wCAiKC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSitemapServerSideProps = void 0;
|
|
4
|
-
const data_fetching_1 = require("../../../data-fetching");
|
|
5
|
-
const SitemapBuilder_1 = require("./SitemapBuilder");
|
|
6
|
-
function normalizeBaseUrl(baseUrl, protocol = 'https') {
|
|
7
|
-
// This regex pattern matches if the `baseUrl`
|
|
8
|
-
// equals `/`, starts with `localhost`, or starts with `http://` or `https://`.
|
|
9
|
-
if (/^(\/|localhost|https?:\/\/)/.test(baseUrl)) {
|
|
10
|
-
return baseUrl;
|
|
11
|
-
}
|
|
12
|
-
// If it's explicitly defined to be `http` only
|
|
13
|
-
if (protocol.toLowerCase() === 'http') {
|
|
14
|
-
return `http://${baseUrl}`;
|
|
15
|
-
}
|
|
16
|
-
// Prefer https if protocol is `https,http` or `https` or any other unknown value
|
|
17
|
-
return `https://${baseUrl}`;
|
|
18
|
-
}
|
|
19
|
-
function getSitemapServerSideProps(options = {}) {
|
|
20
|
-
return async function getServerSideProps(ctx) {
|
|
21
|
-
const { res, req } = ctx;
|
|
22
|
-
if (!req || !res) {
|
|
23
|
-
// client side
|
|
24
|
-
return {
|
|
25
|
-
props: {},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const baseUrl = normalizeBaseUrl(req.headers.host || '/', req.headers['x-forwarded-proto']);
|
|
29
|
-
const api = data_fetching_1.NextContentDelivery.initClient(req);
|
|
30
|
-
const [newsroom, languages, stories, categories] = await Promise.all([
|
|
31
|
-
api.newsroom(),
|
|
32
|
-
api.languages(),
|
|
33
|
-
api.allStories(),
|
|
34
|
-
api.categories(),
|
|
35
|
-
]);
|
|
36
|
-
const sitemapBuilder = new SitemapBuilder_1.SitemapBuilder(baseUrl, options.basePath || process.env.NEXT_PUBLIC_BASE_PATH, languages);
|
|
37
|
-
sitemapBuilder.addPageUrl('/');
|
|
38
|
-
if (newsroom.public_galleries_number > 0) {
|
|
39
|
-
sitemapBuilder.addPageUrl('/media');
|
|
40
|
-
const { galleries } = await api.galleries();
|
|
41
|
-
galleries.forEach((gallery) => sitemapBuilder.addPageUrl(`/media/album/${gallery.uuid}`));
|
|
42
|
-
}
|
|
43
|
-
categories.forEach((category) => sitemapBuilder.addCategoryUrl(category));
|
|
44
|
-
stories.forEach((story) => sitemapBuilder.addStoryUrl(story));
|
|
45
|
-
options.additionalPaths?.forEach((path) => sitemapBuilder.addPageUrl(path));
|
|
46
|
-
res.setHeader('Content-Type', 'text/xml');
|
|
47
|
-
res.write(sitemapBuilder.serialize());
|
|
48
|
-
res.end();
|
|
49
|
-
return {
|
|
50
|
-
props: {},
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.getSitemapServerSideProps = getSitemapServerSideProps;
|
|
55
|
-
//# sourceMappingURL=getServerSideProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getServerSideProps.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts"],"names":[],"mappings":";;;AAEA,0DAA6D;AAE7D,qDAAkD;AAElD,SAAS,gBAAgB,CAAC,OAAe,EAAE,QAAQ,GAAG,OAAO;IACzD,8CAA8C;IAC9C,+EAA+E;IAC/E,IAAI,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,+CAA+C;IAC/C,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QACpC,OAAO,UAAU,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED,iFAAiF;IACjF,OAAO,WAAW,OAAO,EAAE,CAAC;AAChC,C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C;QACD,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAE9D,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAE5E,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,OAAO;YACH,KAAK,EAAE,EAAE;SACZ,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAxDD,8DAwDC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SitemapBuilder = exports.getSitemapServerSideProps = void 0;
|
|
18
|
-
var getServerSideProps_1 = require("./getServerSideProps");
|
|
19
|
-
Object.defineProperty(exports, "getSitemapServerSideProps", { enumerable: true, get: function () { return getServerSideProps_1.getSitemapServerSideProps; } });
|
|
20
|
-
var SitemapBuilder_1 = require("./SitemapBuilder");
|
|
21
|
-
Object.defineProperty(exports, "SitemapBuilder", { enumerable: true, get: function () { return SitemapBuilder_1.SitemapBuilder; } });
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAiE;AAAxD,+HAAA,yBAAyB,OAAA;AAElC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,0CAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@prezly/sdk';
|
|
2
|
-
import type { GetServerSidePropsContext, GetServerSidePropsResult, GetStaticPropsContext, GetStaticPropsResult } from 'next';
|
|
3
|
-
import type { PropsFunction } from './lib/types';
|
|
4
|
-
export declare function getStoryPageServerSideProps<CustomProps extends Record<string, any>>(customProps: CustomProps | PropsFunction<CustomProps>, formats?: Story.FormatVersion[]): (context: GetServerSidePropsContext) => Promise<GetServerSidePropsResult<CustomProps>>;
|
|
5
|
-
export declare function getStoryPageStaticProps<CustomProps extends Record<string, any>>(customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>, formats?: Story.FormatVersion[]): (context: GetStaticPropsContext) => Promise<GetStaticPropsResult<CustomProps>>;
|
|
6
|
-
export declare function getStoryPageStaticPaths(): Promise<{
|
|
7
|
-
paths: {
|
|
8
|
-
params: {
|
|
9
|
-
slug: string;
|
|
10
|
-
};
|
|
11
|
-
}[];
|
|
12
|
-
fallback: string;
|
|
13
|
-
}>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStoryPageStaticPaths = exports.getStoryPageStaticProps = exports.getStoryPageServerSideProps = void 0;
|
|
4
|
-
const data_fetching_1 = require("../../data-fetching");
|
|
5
|
-
const intl_1 = require("../../intl");
|
|
6
|
-
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
7
|
-
const getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
|
|
8
|
-
const processRequest_1 = require("../processRequest");
|
|
9
|
-
const processStaticRequest_1 = require("../processStaticRequest");
|
|
10
|
-
function getStoryPageServerSideProps(customProps, formats) {
|
|
11
|
-
return async function getServerSideProps(context) {
|
|
12
|
-
const { locale, req, params } = context;
|
|
13
|
-
const api = data_fetching_1.NextContentDelivery.initClient(req, { formats });
|
|
14
|
-
const { slug } = params;
|
|
15
|
-
const story = slug ? await api.story({ slug }) : null;
|
|
16
|
-
if (!story) {
|
|
17
|
-
return { notFound: true };
|
|
18
|
-
}
|
|
19
|
-
// [DEV-12082] If the current URL pathname does not match the canonical URL -- redirect.
|
|
20
|
-
if (slug && slug !== story.slug) {
|
|
21
|
-
return {
|
|
22
|
-
redirect: {
|
|
23
|
-
destination: `/${story.slug}`,
|
|
24
|
-
permanent: false,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const { serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context, {
|
|
29
|
-
story,
|
|
30
|
-
});
|
|
31
|
-
if (locale && locale !== intl_1.DUMMY_DEFAULT_LOCALE) {
|
|
32
|
-
return {
|
|
33
|
-
redirect: {
|
|
34
|
-
destination: `/${story.slug}`,
|
|
35
|
-
permanent: true,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
serverSideProps.newsroomContextProps.currentStory = story;
|
|
40
|
-
return (0, processRequest_1.processRequest)(context, {
|
|
41
|
-
...serverSideProps,
|
|
42
|
-
...(typeof customProps === 'function'
|
|
43
|
-
? await customProps(context, serverSideProps)
|
|
44
|
-
: customProps),
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
exports.getStoryPageServerSideProps = getStoryPageServerSideProps;
|
|
49
|
-
function getStoryPageStaticProps(customProps, formats) {
|
|
50
|
-
return async function getStaticProps(context) {
|
|
51
|
-
const api = data_fetching_1.NextContentDelivery.initClient(undefined, { formats });
|
|
52
|
-
const { slug } = context.params;
|
|
53
|
-
const story = slug ? await api.story({ slug }) : null;
|
|
54
|
-
if (!story) {
|
|
55
|
-
return { notFound: true };
|
|
56
|
-
}
|
|
57
|
-
const { staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context, { story });
|
|
58
|
-
staticProps.newsroomContextProps.currentStory = story;
|
|
59
|
-
return (0, processStaticRequest_1.processStaticRequest)(context, {
|
|
60
|
-
...staticProps,
|
|
61
|
-
...(typeof customProps === 'function'
|
|
62
|
-
? await customProps(context, staticProps)
|
|
63
|
-
: customProps),
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
exports.getStoryPageStaticProps = getStoryPageStaticProps;
|
|
68
|
-
async function getStoryPageStaticPaths() {
|
|
69
|
-
const api = data_fetching_1.NextContentDelivery.initClient();
|
|
70
|
-
const stories = await api.allStories();
|
|
71
|
-
const paths = stories.map(({ slug }) => ({ params: { slug } }));
|
|
72
|
-
return {
|
|
73
|
-
paths,
|
|
74
|
-
fallback: 'blocking',
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
exports.getStoryPageStaticPaths = getStoryPageStaticPaths;
|
|
78
|
-
//# sourceMappingURL=story.js.map
|
|
@@ -1 +0,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AK,UAAU,uBAAuB;IACzC,MAAM,GAAG,GAAG,mCAAmB,CAAC,UAAU,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC;IAEvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAEhE,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,UAAU;KACvB,CAAC;AACN,CAAC;AAVD,0DAUC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@prezly/sdk';
|
|
2
|
-
import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
3
|
-
import type { PropsFunction } from './lib/types';
|
|
4
|
-
export declare function getStoryPreviewPageServerSideProps<CustomProps extends Record<string, any>>(customProps: CustomProps | PropsFunction<CustomProps>, formats?: Story.FormatVersion[]): (context: GetServerSidePropsContext) => Promise<GetServerSidePropsResult<CustomProps>>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStoryPreviewPageServerSideProps = void 0;
|
|
4
|
-
const data_fetching_1 = require("../../data-fetching");
|
|
5
|
-
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
6
|
-
const processRequest_1 = require("../processRequest");
|
|
7
|
-
function getStoryPreviewPageServerSideProps(customProps, formats) {
|
|
8
|
-
return async function getServerSideProps(context) {
|
|
9
|
-
const api = data_fetching_1.NextContentDelivery.initClient(context.req, { formats });
|
|
10
|
-
const { uuid } = context.params;
|
|
11
|
-
const story = await api.story({ uuid });
|
|
12
|
-
if (!story) {
|
|
13
|
-
return { notFound: true };
|
|
14
|
-
}
|
|
15
|
-
const { serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context, {
|
|
16
|
-
story,
|
|
17
|
-
});
|
|
18
|
-
serverSideProps.newsroomContextProps.currentStory = story;
|
|
19
|
-
return (0, processRequest_1.processRequest)(context, {
|
|
20
|
-
...serverSideProps,
|
|
21
|
-
...(typeof customProps === 'function'
|
|
22
|
-
? await customProps(context, serverSideProps)
|
|
23
|
-
: customProps),
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.getStoryPreviewPageServerSideProps = getStoryPreviewPageServerSideProps;
|
|
28
|
-
//# sourceMappingURL=storyPreview.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":";;;AAGA,uDAA0D;AAC1D,8EAA2E;AAC3E,sDAAmD;AAInD,SAAgB,kCAAkC,CAC9C,WAAqD,EACrD,OAA+B;IAE/B,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,mCAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACrE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC9B,CAAC;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,EAAE;YAClE,KAAK;SACR,CAAC,CAAC;QAEH,eAAe,CAAC,oBAAoB,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1D,OAAO,IAAA,+BAAc,EAAC,OAAO,EAAE;YAC3B,GAAG,eAAe;YAClB,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AA3BD,gFA2BC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
2
|
-
import type { PageProps, ServerSidePageProps } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* This function combines the props returned from `getNewsroomServerSideProps` and your optional custom props for the page.
|
|
5
|
-
* It also handles locale redirects, if `canonicalUrl` parameter is provided.
|
|
6
|
-
* See README for usage examples.
|
|
7
|
-
*
|
|
8
|
-
* @param context Next.js context passed to the `getServerSideProps` method of the page
|
|
9
|
-
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
10
|
-
* @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
|
|
11
|
-
*/
|
|
12
|
-
export declare function processRequest<Props>(context: GetServerSidePropsContext, props: Props & PageProps & ServerSidePageProps, canonicalUrl?: string): GetServerSidePropsResult<Props>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processRequest = void 0;
|
|
4
|
-
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
5
|
-
const intl_1 = require("../intl");
|
|
6
|
-
/**
|
|
7
|
-
* This function combines the props returned from `getNewsroomServerSideProps` and your optional custom props for the page.
|
|
8
|
-
* It also handles locale redirects, if `canonicalUrl` parameter is provided.
|
|
9
|
-
* See README for usage examples.
|
|
10
|
-
*
|
|
11
|
-
* @param context Next.js context passed to the `getServerSideProps` method of the page
|
|
12
|
-
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
13
|
-
* @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
|
|
14
|
-
*/
|
|
15
|
-
function processRequest(context, props, canonicalUrl) {
|
|
16
|
-
(0, theme_kit_core_1.assertServerEnv)('processRequest');
|
|
17
|
-
const { locale: nextLocale, query, res } = context;
|
|
18
|
-
if (process.env.NODE_ENV === 'production') {
|
|
19
|
-
// Since Next 13, Cache-Control header set in `next.config.js` is overwritten by Next in production, effectively bypassing any caching systems setup on top of the theme.
|
|
20
|
-
// This is a workaround for that issue. See https://nextjs.org/docs/pages/building-your-application/deploying/production-checklist#caching
|
|
21
|
-
res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate');
|
|
22
|
-
}
|
|
23
|
-
const { localeResolved, ...pageProps } = props;
|
|
24
|
-
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
25
|
-
// In that case we won't show 404 page.
|
|
26
|
-
if (!localeResolved && nextLocale) {
|
|
27
|
-
return { notFound: true };
|
|
28
|
-
}
|
|
29
|
-
if (canonicalUrl) {
|
|
30
|
-
const { languages, localeCode } = pageProps.newsroomContextProps;
|
|
31
|
-
const currentLocale = theme_kit_core_1.LocaleObject.fromAnyCode(localeCode);
|
|
32
|
-
const shortestLocaleCode = (0, theme_kit_core_1.getShortestLocaleCode)(languages, currentLocale);
|
|
33
|
-
const redirect = (0, intl_1.getRedirectToCanonicalLocale)(shortestLocaleCode, nextLocale, canonicalUrl, query);
|
|
34
|
-
if (redirect) {
|
|
35
|
-
return { redirect };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
props: pageProps,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.processRequest = processRequest;
|
|
43
|
-
//# sourceMappingURL=processRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":";;;AAAA,2DAA8F;AAG9F,kCAAuD;AAGvD;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,IAAA,gCAAe,EAAC,gBAAgB,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEnD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QACxC,yKAAyK;QACzK,0IAA0I;QAC1I,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,oCAAoC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE,CAAC;QAChC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACf,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,oBAAoB,CAAC;QACjE,MAAM,aAAa,GAAG,6BAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,IAAA,sCAAqB,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,IAAA,mCAA4B,EACzC,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,CACR,CAAC;QACF,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,QAAQ,EAAE,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;KACxC,CAAC;AACN,CAAC;AAzCD,wCAyCC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { GetStaticPropsContext, GetStaticPropsResult } from 'next';
|
|
2
|
-
import type { PageProps, ServerSidePageProps } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* This function combines the props returned from `getNewsroomStaticProps` and your optional custom props for the page.
|
|
5
|
-
* See README for usage examples.
|
|
6
|
-
*
|
|
7
|
-
* @param context Next.js context passed to the `getStaticProps` method of the page
|
|
8
|
-
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
9
|
-
* @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
|
|
10
|
-
*/
|
|
11
|
-
export declare function processStaticRequest<Props>(context: GetStaticPropsContext, props: Props & PageProps & ServerSidePageProps, revalidateTimeout?: number): GetStaticPropsResult<Props>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processStaticRequest = void 0;
|
|
4
|
-
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
5
|
-
/**
|
|
6
|
-
* This function combines the props returned from `getNewsroomStaticProps` and your optional custom props for the page.
|
|
7
|
-
* See README for usage examples.
|
|
8
|
-
*
|
|
9
|
-
* @param context Next.js context passed to the `getStaticProps` method of the page
|
|
10
|
-
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
11
|
-
* @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
|
|
12
|
-
*/
|
|
13
|
-
function processStaticRequest(context, props, revalidateTimeout) {
|
|
14
|
-
(0, theme_kit_core_1.assertServerEnv)('processStaticRequest');
|
|
15
|
-
const { locale: nextLocale } = context;
|
|
16
|
-
const { localeResolved, ...pageProps } = props;
|
|
17
|
-
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
18
|
-
// In that case we won't show 404 page.
|
|
19
|
-
if (!localeResolved && nextLocale) {
|
|
20
|
-
return { notFound: true };
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
props: pageProps,
|
|
24
|
-
revalidate: revalidateTimeout,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.processStaticRequest = processStaticRequest;
|
|
28
|
-
//# sourceMappingURL=processStaticRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAKzD;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,IAAA,gCAAe,EAAC,sBAAsB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE,CAAC;QAChC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;QACrC,UAAU,EAAE,iBAAiB;KAChC,CAAC;AACN,CAAC;AApBD,oDAoBC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { NextSeoProps } from 'next-seo';
|
|
2
|
-
type Props = Omit<NextSeoProps, 'title'> & {
|
|
3
|
-
/**
|
|
4
|
-
* Overrides the title that is used in the `<title>` tag and in the `og:title` meta tag. Defaults to the Site SEO title or Site name.
|
|
5
|
-
* If a function is provided, it will be called with the Site SEO title as the first argument.
|
|
6
|
-
*/
|
|
7
|
-
title?: string | ((metaTitle: string) => string);
|
|
8
|
-
imageUrl?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* This component provides base page attributes for every Newsroom page.
|
|
12
|
-
* It depends on information from NewsroomContext, so the component should be placed inside the `NewsroomContextProvider`.
|
|
13
|
-
* You can pass additional props expected by NextSeo component to override any info that is provided by the NewsroomContext.
|
|
14
|
-
*/
|
|
15
|
-
export declare function PageSeo({ title, description, imageUrl, canonical, openGraph, twitter, ...nextSeoProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageSeo = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
6
|
-
const router_1 = require("next/router");
|
|
7
|
-
const next_seo_1 = require("next-seo");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const newsroom_context_1 = require("../../newsroom-context");
|
|
10
|
-
const lib_1 = require("./lib");
|
|
11
|
-
/**
|
|
12
|
-
* This component provides base page attributes for every Newsroom page.
|
|
13
|
-
* It depends on information from NewsroomContext, so the component should be placed inside the `NewsroomContextProvider`.
|
|
14
|
-
* You can pass additional props expected by NextSeo component to override any info that is provided by the NewsroomContext.
|
|
15
|
-
*/
|
|
16
|
-
function PageSeo({ title, description, imageUrl, canonical, openGraph, twitter, ...nextSeoProps }) {
|
|
17
|
-
const companyInformation = (0, newsroom_context_1.useCompanyInformation)();
|
|
18
|
-
const site = (0, newsroom_context_1.useNewsroom)();
|
|
19
|
-
const currentLocale = (0, newsroom_context_1.useCurrentLocale)();
|
|
20
|
-
const languages = (0, newsroom_context_1.useLanguages)();
|
|
21
|
-
const getTranslationUrl = (0, newsroom_context_1.useGetTranslationUrl)();
|
|
22
|
-
const getLinkLocaleSlug = (0, newsroom_context_1.useGetLinkLocaleSlug)();
|
|
23
|
-
const currentStory = (0, newsroom_context_1.useCurrentStory)();
|
|
24
|
-
const { asPath, basePath } = (0, router_1.useRouter)();
|
|
25
|
-
const currentPath = `${basePath}${asPath}`;
|
|
26
|
-
const pageTitle = (0, react_1.useMemo)(() => {
|
|
27
|
-
const defaultMetaTitle = companyInformation.seo_settings.meta_title ||
|
|
28
|
-
companyInformation.seo_settings.default_meta_title ||
|
|
29
|
-
companyInformation.name;
|
|
30
|
-
if (title && typeof title === 'function') {
|
|
31
|
-
return title(defaultMetaTitle);
|
|
32
|
-
}
|
|
33
|
-
return title || defaultMetaTitle;
|
|
34
|
-
}, [title, companyInformation]);
|
|
35
|
-
const pageDescription = description ||
|
|
36
|
-
companyInformation.seo_settings.meta_description ||
|
|
37
|
-
companyInformation.seo_settings.default_meta_description ||
|
|
38
|
-
companyInformation.about_plaintext;
|
|
39
|
-
const canonicalUrl = canonical || (0, lib_1.getAbsoluteUrl)(currentPath, site.url, getLinkLocaleSlug(currentLocale));
|
|
40
|
-
const siteName = companyInformation.name;
|
|
41
|
-
const sharingImageUrl = imageUrl || (0, theme_kit_core_1.getNewsroomOgImageUrl)(site, currentLocale);
|
|
42
|
-
const alternateLanguageLinks = (0, react_1.useMemo)(() => {
|
|
43
|
-
if (!languages.length) {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
const usedLanguages = (0, theme_kit_core_1.getUsedLanguages)(languages);
|
|
47
|
-
return (0, theme_kit_core_1.getAlternateLanguageLinks)(usedLanguages, (locale) => {
|
|
48
|
-
const translationUrl = getTranslationUrl(locale);
|
|
49
|
-
if (!translationUrl) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
return (0, lib_1.getAbsoluteUrl)(translationUrl, site.url, currentStory && translationUrl !== '/' ? false : getLinkLocaleSlug(locale));
|
|
53
|
-
});
|
|
54
|
-
}, [currentStory, getLinkLocaleSlug, getTranslationUrl, languages, site.url]);
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(next_seo_1.NextSeo, { title: pageTitle, description: pageDescription, canonical: canonicalUrl, noindex: nextSeoProps.noindex || !site.is_indexable, nofollow: nextSeoProps.nofollow || !site.is_indexable, openGraph: {
|
|
56
|
-
url: canonicalUrl,
|
|
57
|
-
title: pageTitle,
|
|
58
|
-
description: pageDescription,
|
|
59
|
-
locale: currentLocale.toUnderscoreCode(),
|
|
60
|
-
images: [
|
|
61
|
-
{
|
|
62
|
-
url: sharingImageUrl,
|
|
63
|
-
alt: pageTitle,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
site_name: siteName,
|
|
67
|
-
...openGraph,
|
|
68
|
-
}, twitter: {
|
|
69
|
-
site: siteName,
|
|
70
|
-
cardType: 'summary',
|
|
71
|
-
...twitter,
|
|
72
|
-
}, additionalMetaTags: [
|
|
73
|
-
{ name: 'twitter:image', content: sharingImageUrl },
|
|
74
|
-
site.google_search_console_key && {
|
|
75
|
-
name: 'google-site-verification',
|
|
76
|
-
content: site.google_search_console_key,
|
|
77
|
-
},
|
|
78
|
-
].filter((tag) => Boolean(tag)), additionalLinkTags: [
|
|
79
|
-
{
|
|
80
|
-
rel: 'alternate',
|
|
81
|
-
type: 'application/rss+xml',
|
|
82
|
-
href: (0, lib_1.getAbsoluteUrl)(`${basePath}/feed`, site.url),
|
|
83
|
-
},
|
|
84
|
-
], languageAlternates: alternateLanguageLinks, ...nextSeoProps }));
|
|
85
|
-
}
|
|
86
|
-
exports.PageSeo = PageSeo;
|
|
87
|
-
//# sourceMappingURL=PageSeo.js.map
|