@adobe/helix-html-pipeline 5.7.0 → 5.7.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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/sitemap-pipe.js +7 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.7.2](https://github.com/adobe/helix-html-pipeline/compare/v5.7.1...v5.7.2) (2024-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* handle sitemap auth in hlx.page ([#533](https://github.com/adobe/helix-html-pipeline/issues/533)) ([bc95dae](https://github.com/adobe/helix-html-pipeline/commit/bc95daecbdc0a806b61cd00360e68100beb28ece))
|
|
7
|
+
|
|
8
|
+
## [5.7.1](https://github.com/adobe/helix-html-pipeline/compare/v5.7.0...v5.7.1) (2024-02-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* put <loc> on a single line ([#532](https://github.com/adobe/helix-html-pipeline/issues/532)) ([c8626eb](https://github.com/adobe/helix-html-pipeline/commit/c8626eb6a45819cdb8f6348752fb2883d9a2a7d9))
|
|
14
|
+
|
|
1
15
|
# [5.7.0](https://github.com/adobe/helix-html-pipeline/compare/v5.6.3...v5.7.0) (2024-02-05)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/sitemap-pipe.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import escape from 'lodash.escape';
|
|
13
13
|
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
|
|
14
|
-
import {
|
|
14
|
+
import { requireProject } from './steps/authenticate.js';
|
|
15
15
|
import fetchConfig from './steps/fetch-config.js';
|
|
16
16
|
import fetchContent from './steps/fetch-content.js';
|
|
17
17
|
import fetchConfigAll from './steps/fetch-config-all.js';
|
|
@@ -21,9 +21,9 @@ import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
|
|
|
21
21
|
import { PipelineStatusError } from './PipelineStatusError.js';
|
|
22
22
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
23
23
|
|
|
24
|
-
async function generateSitemap(state
|
|
24
|
+
async function generateSitemap(state) {
|
|
25
25
|
const {
|
|
26
|
-
owner, repo, ref, contentBusId, s3Loader, log,
|
|
26
|
+
owner, repo, ref, contentBusId, s3Loader, log, partition,
|
|
27
27
|
previewHost, liveHost, config: { host: prodCDN } = {},
|
|
28
28
|
} = state;
|
|
29
29
|
const ret = await s3Loader.getObject('helix-content-bus', `${contentBusId}/live/sitemap.json`);
|
|
@@ -45,9 +45,7 @@ async function generateSitemap(state, partition) {
|
|
|
45
45
|
? (previewHost || `${ref}--${repo}--${owner}.hlx.page`)
|
|
46
46
|
: (prodCDN || liveHost || `${ref}--${repo}--${owner}.hlx.live`);
|
|
47
47
|
const loc = ({ path, lastModified }) => ` <url>
|
|
48
|
-
<loc>
|
|
49
|
-
https://${host}${escape(path)}
|
|
50
|
-
</loc>
|
|
48
|
+
<loc>https://${host}${escape(path)}</loc>
|
|
51
49
|
<lastmod>${new Date(lastModified * 1000).toISOString().substring(0, 10)}</lastmod>
|
|
52
50
|
</url>`;
|
|
53
51
|
const xml = [
|
|
@@ -76,12 +74,9 @@ async function generateSitemap(state, partition) {
|
|
|
76
74
|
* @returns {PipelineResponse}
|
|
77
75
|
*/
|
|
78
76
|
export async function sitemapPipe(state, req) {
|
|
79
|
-
const {
|
|
77
|
+
const { log } = state;
|
|
80
78
|
state.type = 'sitemap';
|
|
81
79
|
|
|
82
|
-
// force loading from preview
|
|
83
|
-
state.partition = 'preview';
|
|
84
|
-
|
|
85
80
|
if (state.info?.path !== '/sitemap.xml') {
|
|
86
81
|
// this should not happen as it would mean that the caller used the wrong route. so we respond
|
|
87
82
|
// with a 500 to indicate that something is wrong.
|
|
@@ -100,8 +95,6 @@ export async function sitemapPipe(state, req) {
|
|
|
100
95
|
},
|
|
101
96
|
});
|
|
102
97
|
|
|
103
|
-
// check if .auth request
|
|
104
|
-
|
|
105
98
|
try { // fetch config first, since we need to compute the content-bus-id from the fstab ...
|
|
106
99
|
state.timer?.update('config-fetch');
|
|
107
100
|
await fetchConfig(state, req, res);
|
|
@@ -120,11 +113,9 @@ export async function sitemapPipe(state, req) {
|
|
|
120
113
|
]);
|
|
121
114
|
|
|
122
115
|
await requireProject(state, req, res);
|
|
123
|
-
|
|
124
|
-
await authenticate(state, req, res);
|
|
125
|
-
}
|
|
116
|
+
// authentication is handled in hlx.page vcl
|
|
126
117
|
if (res.status === 404) {
|
|
127
|
-
const ret = await generateSitemap(state
|
|
118
|
+
const ret = await generateSitemap(state);
|
|
128
119
|
if (ret.status === 200) {
|
|
129
120
|
res.status = 200;
|
|
130
121
|
delete res.error;
|