@adobe/helix-config 2.7.0 → 2.8.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 +14 -0
- package/package.json +1 -1
- package/src/config-legacy.js +19 -0
- package/src/config-view.js +9 -1
- package/src/schemas/common.schema.json +1 -1
- package/src/schemas/profile.schema.json +3 -0
- package/src/schemas/robots.schema.cjs +12 -0
- package/src/schemas/robots.schema.json +23 -0
- package/src/schemas/site.schema.json +3 -0
- package/src/storage/config-store.js +1 -0
- package/src/storage/config-validator.js +2 -0
- package/types/profile-config.d.ts +5 -1
- package/types/site-config.d.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.8.0](https://github.com/adobe/helix-config/compare/v2.7.1...v2.8.0) (2024-04-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add support for robots.txt ([#57](https://github.com/adobe/helix-config/issues/57)) ([dedfec3](https://github.com/adobe/helix-config/commit/dedfec38c0ff97953b71ea3d71a4547f981eb56d)), closes [#56](https://github.com/adobe/helix-config/issues/56)
|
|
7
|
+
|
|
8
|
+
## [2.7.1](https://github.com/adobe/helix-config/compare/v2.7.0...v2.7.1) (2024-04-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* adjust regexp for modifiers map ([#55](https://github.com/adobe/helix-config/issues/55)) ([b480fbb](https://github.com/adobe/helix-config/commit/b480fbbe25215950660353aae65820c462df7004))
|
|
14
|
+
|
|
1
15
|
# [2.7.0](https://github.com/adobe/helix-config/compare/v2.6.0...v2.7.0) (2024-04-23)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/config-legacy.js
CHANGED
|
@@ -66,6 +66,19 @@ async function fetchConfigAll(ctx, contentBusId, partition) {
|
|
|
66
66
|
return res.json();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves the robots.txt from the code-bus
|
|
71
|
+
* @param {ConfigContext} ctx the context
|
|
72
|
+
* @param {string} owner
|
|
73
|
+
* @param {string} repo
|
|
74
|
+
* @returns {Promise<string|null>} the robots.txt
|
|
75
|
+
*/
|
|
76
|
+
export async function fetchRobotsTxt(ctx, owner, repo) {
|
|
77
|
+
const key = `${owner}/${repo}/main/robots.txt`;
|
|
78
|
+
const res = await ctx.loader.getObject(HELIX_CODE_BUS, key);
|
|
79
|
+
return res.body;
|
|
80
|
+
}
|
|
81
|
+
|
|
69
82
|
/**
|
|
70
83
|
* Loads the content from a helix 4 project.
|
|
71
84
|
* @param {ConfigContext} ctx
|
|
@@ -131,6 +144,12 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
|
|
|
131
144
|
if (configAllLive?.metadata) {
|
|
132
145
|
config.metadata.live = configAllLive.metadata;
|
|
133
146
|
}
|
|
147
|
+
const robots = await fetchRobotsTxt(ctx, rso.org, rso.site);
|
|
148
|
+
if (robots) {
|
|
149
|
+
config.robots = {
|
|
150
|
+
txt: robots,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
134
153
|
}
|
|
135
154
|
return config;
|
|
136
155
|
}
|
package/src/config-view.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
SCOPE_DELIVERY,
|
|
19
19
|
SCOPE_RAW,
|
|
20
20
|
} from './ConfigContext.js';
|
|
21
|
-
import { resolveLegacyConfig } from './config-legacy.js';
|
|
21
|
+
import { resolveLegacyConfig, fetchRobotsTxt } from './config-legacy.js';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @typedef Config
|
|
@@ -167,6 +167,12 @@ async function resolveConfig(ctx, rso, scope) {
|
|
|
167
167
|
preview: await loadMetadata(ctx, config, 'preview'),
|
|
168
168
|
live: await loadMetadata(ctx, config, 'live'),
|
|
169
169
|
};
|
|
170
|
+
if (!config.robots) {
|
|
171
|
+
const txt = await fetchRobotsTxt(ctx, config.code.owner, config.code.repo);
|
|
172
|
+
if (txt) {
|
|
173
|
+
config.robots = { txt };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
170
176
|
}
|
|
171
177
|
if (scope === SCOPE_PIPELINE || scope === SCOPE_DELIVERY) {
|
|
172
178
|
config.head = await loadHeadHtml(ctx, config, rso.ref);
|
|
@@ -254,6 +260,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
254
260
|
},
|
|
255
261
|
};
|
|
256
262
|
delete adminConfig.public;
|
|
263
|
+
delete adminConfig.robots;
|
|
257
264
|
return new PipelineResponse(JSON.stringify(adminConfig, null, 2), {
|
|
258
265
|
headers: {
|
|
259
266
|
'content-type': 'application/json',
|
|
@@ -288,6 +295,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
288
295
|
cdn: config.cdn,
|
|
289
296
|
folders: config.folders,
|
|
290
297
|
public: config.public,
|
|
298
|
+
robots: config.robots,
|
|
291
299
|
};
|
|
292
300
|
return new PipelineResponse(JSON.stringify(pipelineConfig, null, 2), {
|
|
293
301
|
headers: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./robots.schema.json');
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta:license": [
|
|
3
|
+
"Copyright 2024 Adobe. All rights reserved.",
|
|
4
|
+
"This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
|
|
5
|
+
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
+
"of the License at http://www.apache.org/licenses/LICENSE-2.0",
|
|
7
|
+
"",
|
|
8
|
+
"Unless required by applicable law or agreed to in writing, software distributed under",
|
|
9
|
+
"the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
|
|
10
|
+
"OF ANY KIND, either express or implied. See the License for the specific language",
|
|
11
|
+
"governing permissions and limitations under the License."
|
|
12
|
+
],
|
|
13
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
14
|
+
"$id": "https://ns.adobe.com/helix/config/robots",
|
|
15
|
+
"type": "object",
|
|
16
|
+
"title": "robots",
|
|
17
|
+
"properties": {
|
|
18
|
+
"txt": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false
|
|
23
|
+
}
|
|
@@ -26,6 +26,7 @@ import markupSchema from '../schemas/content-source-markup.schema.cjs';
|
|
|
26
26
|
import metadataSchema from '../schemas/metadata-source.schema.cjs';
|
|
27
27
|
import onedriveSchema from '../schemas/content-source-onedrive.schema.cjs';
|
|
28
28
|
import profileSchema from '../schemas/profile.schema.cjs';
|
|
29
|
+
import robotsSchema from '../schemas/robots.schema.cjs';
|
|
29
30
|
import sidekickSchema from '../schemas/sidekick.schema.cjs';
|
|
30
31
|
import siteSchema from '../schemas/site.schema.cjs';
|
|
31
32
|
|
|
@@ -43,6 +44,7 @@ const SCHEMAS = [
|
|
|
43
44
|
metadataSchema,
|
|
44
45
|
onedriveSchema,
|
|
45
46
|
profileSchema,
|
|
47
|
+
robotsSchema,
|
|
46
48
|
sidekickSchema,
|
|
47
49
|
siteSchema,
|
|
48
50
|
];
|
|
@@ -31,6 +31,7 @@ export interface HelixProfileConfig {
|
|
|
31
31
|
access?: Access;
|
|
32
32
|
sidekick?: SidekickConfig;
|
|
33
33
|
metadata?: Metadata;
|
|
34
|
+
robots?: Robots;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Defines the content bus location and source.
|
|
@@ -99,7 +100,7 @@ export interface Folders {
|
|
|
99
100
|
export interface ModifierMap {
|
|
100
101
|
/**
|
|
101
102
|
* This interface was referenced by `ModifierMap`'s JSON-Schema definition
|
|
102
|
-
* via the `patternProperty` "^/[a-zA-Z0-9-/.]
|
|
103
|
+
* via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
|
|
103
104
|
*/
|
|
104
105
|
[k: string]: [] | [KeyValuePair];
|
|
105
106
|
}
|
|
@@ -247,3 +248,6 @@ export interface SidekickPlugin {
|
|
|
247
248
|
export interface Metadata {
|
|
248
249
|
source?: [] | [string];
|
|
249
250
|
}
|
|
251
|
+
export interface Robots {
|
|
252
|
+
txt?: string;
|
|
253
|
+
}
|
package/types/site-config.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface HelixSiteConfig {
|
|
|
34
34
|
access?: Access;
|
|
35
35
|
sidekick?: SidekickConfig;
|
|
36
36
|
metadata?: Metadata;
|
|
37
|
+
robots?: Robots;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* Defines the content bus location and source.
|
|
@@ -102,7 +103,7 @@ export interface Folders {
|
|
|
102
103
|
export interface ModifierMap {
|
|
103
104
|
/**
|
|
104
105
|
* This interface was referenced by `ModifierMap`'s JSON-Schema definition
|
|
105
|
-
* via the `patternProperty` "^/[a-zA-Z0-9-/.]
|
|
106
|
+
* via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
|
|
106
107
|
*/
|
|
107
108
|
[k: string]: [] | [KeyValuePair];
|
|
108
109
|
}
|
|
@@ -250,3 +251,6 @@ export interface SidekickPlugin {
|
|
|
250
251
|
export interface Metadata {
|
|
251
252
|
source?: [] | [string];
|
|
252
253
|
}
|
|
254
|
+
export interface Robots {
|
|
255
|
+
txt?: string;
|
|
256
|
+
}
|