@newskit-render/core 2.15.0 → 2.16.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/CHANGELOG.md +8 -0
- package/config/environment.ts +2 -0
- package/next.config.js +12 -0
- package/package.json +2 -2
- package/pages/api/competitions-sitemap.ts +20 -0
- package/pages/api/pages-sitemap.ts +28 -0
- package/pages/api/robots.ts +19 -0
- package/pages/api/sitemap.ts +1 -7
- package/public/robots.txt +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.16.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.16.0-alpha.0...@newskit-render/core@2.16.0) (2022-11-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @newskit-render/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [2.15.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.15.0-alpha.0...@newskit-render/core@2.15.0) (2022-11-04)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @newskit-render/core
|
package/config/environment.ts
CHANGED
|
@@ -40,6 +40,7 @@ export const getSanitizedConfig = () => {
|
|
|
40
40
|
algoliaAppId: process.env.ALGOLIA_APP_ID as string,
|
|
41
41
|
algoliaApiKey: process.env.ALGOLIA_API_KEY as string,
|
|
42
42
|
algoliaIndex: process.env.ALGOLIA_INDEX as string,
|
|
43
|
+
nodeEnviroment: process.env.NODE_ENV as string,
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -67,4 +68,5 @@ export const {
|
|
|
67
68
|
algoliaAppId,
|
|
68
69
|
algoliaApiKey,
|
|
69
70
|
algoliaIndex,
|
|
71
|
+
nodeEnviroment,
|
|
70
72
|
} = config
|
package/next.config.js
CHANGED
|
@@ -37,6 +37,14 @@ module.exports = withBundleAnalyzer(
|
|
|
37
37
|
source: '/sitemap.xml',
|
|
38
38
|
destination: '/api/sitemap',
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
source: '/pages-sitemap.xml',
|
|
42
|
+
destination: '/api/pages-sitemap',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
source: '/competitions-sitemap.xml',
|
|
46
|
+
destination: '/api/competitions-sitemap',
|
|
47
|
+
},
|
|
40
48
|
{
|
|
41
49
|
source: '/news-sitemap.xml',
|
|
42
50
|
destination: '/api/news-sitemap',
|
|
@@ -45,6 +53,10 @@ module.exports = withBundleAnalyzer(
|
|
|
45
53
|
source: '/feed',
|
|
46
54
|
destination: '/api/feed',
|
|
47
55
|
},
|
|
56
|
+
{
|
|
57
|
+
source: '/robots.txt',
|
|
58
|
+
destination: '/api/robots',
|
|
59
|
+
},
|
|
48
60
|
]
|
|
49
61
|
},
|
|
50
62
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@newskit-render/auth": "^1.1.1",
|
|
43
43
|
"@newskit-render/checkout": "^1.5.3",
|
|
44
44
|
"@newskit-render/feature-flags": "^1.2.0",
|
|
45
|
-
"@newskit-render/feed": "^1.
|
|
45
|
+
"@newskit-render/feed": "^1.2.0",
|
|
46
46
|
"@newskit-render/my-account": "^3.13.0",
|
|
47
47
|
"@newskit-render/shared-components": "^1.12.0",
|
|
48
48
|
"@newskit-render/standalone-components": "^1.9.1",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
+
import { genericSitemap } from '@newskit-render/feed'
|
|
3
|
+
import { Publisher } from '@newskit-render/api'
|
|
4
|
+
import { getHost } from '@newskit-render/shared-components'
|
|
5
|
+
import { publisher, sitemapPublicationName } from '../../config'
|
|
6
|
+
/* We do not have sitemap date for Demo so using Virgin,
|
|
7
|
+
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
11
|
+
genericSitemap({
|
|
12
|
+
res,
|
|
13
|
+
dataType: 'competitions',
|
|
14
|
+
publisher:
|
|
15
|
+
publisher === 'DEMO' ? Publisher.VIRGIN : (publisher as Publisher),
|
|
16
|
+
domain: new URL(getHost(req) as string).host,
|
|
17
|
+
publicationName: sitemapPublicationName as string,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export default handler
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
+
import { genericSitemap, CustomStaticPage } from '@newskit-render/feed'
|
|
3
|
+
import { Publisher } from '@newskit-render/api'
|
|
4
|
+
import { getHost } from '@newskit-render/shared-components'
|
|
5
|
+
import { publisher, sitemapPublicationName } from '../../config'
|
|
6
|
+
/* We do not have sitemap date for Demo so using Virgin,
|
|
7
|
+
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const defaultCustomStaticPagesCollection: CustomStaticPage[] = [
|
|
11
|
+
{
|
|
12
|
+
slug: 'test-custom-page',
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
16
|
+
genericSitemap({
|
|
17
|
+
res,
|
|
18
|
+
dataType: 'pages',
|
|
19
|
+
publisher:
|
|
20
|
+
publisher === 'DEMO' ? Publisher.VIRGIN : (publisher as Publisher),
|
|
21
|
+
domain: new URL(getHost(req) as string).host,
|
|
22
|
+
publicationName: sitemapPublicationName as string,
|
|
23
|
+
customStaticPageCollection: defaultCustomStaticPagesCollection,
|
|
24
|
+
changefreq: 'hourly',
|
|
25
|
+
priority: '0.8',
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export default handler
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
+
import { getHost } from '@newskit-render/shared-components'
|
|
3
|
+
import { nodeEnviroment } from '../../config'
|
|
4
|
+
|
|
5
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
6
|
+
const crawable =
|
|
7
|
+
nodeEnviroment === 'production' ? 'Disallow: /' : 'Disallow: /' // change to Allow when your ready for prod to be crawlable
|
|
8
|
+
const robots = `User-agent: *
|
|
9
|
+
${crawable}
|
|
10
|
+
Sitemap: ${new URL(getHost(req) as string)}sitemap.xml
|
|
11
|
+
Sitemap: ${new URL(getHost(req) as string)}news-sitemap.xml
|
|
12
|
+
Sitemap: ${new URL(getHost(req) as string)}pages-sitemap.xml
|
|
13
|
+
Sitemap: ${new URL(getHost(req) as string)}competitions-sitemap.xml`
|
|
14
|
+
|
|
15
|
+
res.statusCode = 200
|
|
16
|
+
res.setHeader('Content-Type', 'text/plain')
|
|
17
|
+
res.write(robots)
|
|
18
|
+
res.end()
|
|
19
|
+
}
|
package/pages/api/sitemap.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
-
import { genericSitemap
|
|
2
|
+
import { genericSitemap } from '@newskit-render/feed'
|
|
3
3
|
import { Publisher } from '@newskit-render/api'
|
|
4
4
|
import { getHost } from '@newskit-render/shared-components'
|
|
5
5
|
import {
|
|
@@ -11,11 +11,6 @@ import {
|
|
|
11
11
|
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
const defaultCustomStaticPagesCollection: CustomStaticPage[] = [
|
|
15
|
-
{
|
|
16
|
-
channel: 'test-custom-page',
|
|
17
|
-
},
|
|
18
|
-
]
|
|
19
14
|
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
20
15
|
genericSitemap({
|
|
21
16
|
res,
|
|
@@ -25,7 +20,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
|
25
20
|
domain: new URL(getHost(req) as string).host,
|
|
26
21
|
firstArticleDate: sitemapFirstPublicationDate as string,
|
|
27
22
|
publicationName: sitemapPublicationName as string,
|
|
28
|
-
customStaticPageCollection: defaultCustomStaticPagesCollection,
|
|
29
23
|
})
|
|
30
24
|
|
|
31
25
|
export default handler
|
package/public/robots.txt
DELETED