build(docs-infra): take disambiguated doc paths into account when generating the sitemap (#41842)
In ##41788, the `disambiguateDocsPathsProcessor` was introduced to fix an issue with case-insensitively equal paths. This processor may alter the paths of some docs and thus their final URL in the app. Previously, both the `disambiguateDocPathsProcessor` and the `createSitemap` processor (which relies on the docs' computed paths to generate the sitemap file) were configured to run before the "rendering-docs" phase. However, this resulted in the `disambiguateDocPathsProcessor`'s running after `createSitemap`, which meant that the sitemap did not include the updated doc paths. This commit fixes it by ensuring that the `disambiguateDocPathsProcessor` is explicitly run before the `createSitemap` processor, so that the latter will be able to take into account any changes made by the former. PR Close #41842
This commit is contained in:
parent
1aee5a79c6
commit
2076bde100
|
@ -18,7 +18,7 @@
|
||||||
module.exports = function disambiguateDocPathsProcessor(log) {
|
module.exports = function disambiguateDocPathsProcessor(log) {
|
||||||
return {
|
return {
|
||||||
$runAfter: ['paths-computed'],
|
$runAfter: ['paths-computed'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs', 'createSitemap'],
|
||||||
$process(docs) {
|
$process(docs) {
|
||||||
// Collect all the ambiguous docs, whose outputPath is are only different by casing.
|
// Collect all the ambiguous docs, whose outputPath is are only different by casing.
|
||||||
const ambiguousDocMap = new Map();
|
const ambiguousDocMap = new Map();
|
||||||
|
|
|
@ -22,6 +22,10 @@ describe('disambiguateDocPaths processor', () => {
|
||||||
expect(processor).toBeDefined();
|
expect(processor).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be run before creating the sitemap', () => {
|
||||||
|
expect(processor.$runBefore).toContain('createSitemap');
|
||||||
|
});
|
||||||
|
|
||||||
it('should create `disambiguator` documents for docs that have ambiguous outputPaths', () => {
|
it('should create `disambiguator` documents for docs that have ambiguous outputPaths', () => {
|
||||||
const numDocs = docs.length;
|
const numDocs = docs.length;
|
||||||
processor.$process(docs);
|
processor.$process(docs);
|
||||||
|
|
Loading…
Reference in New Issue