Skip to content

Commit b4cdc26

Browse files
committed
refactor(tools): use pfe config for tag aliasing in DocsPage
1 parent 39d1bd3 commit b4cdc26

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/pfe-tools/11ty/DocsPage.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PfeConfig } from '../config.js';
2+
import { getPfeConfig } from '../config.js';
23
import { Manifest } from '../custom-elements-manifest/lib/Manifest.js';
34

45
import slugify from 'slugify';
@@ -20,12 +21,14 @@ export class DocsPage {
2021
summary?: string | null;
2122
docsTemplatePath?: string;
2223
constructor(public manifest: Manifest, options?: DocsPageOptions) {
24+
const config = getPfeConfig(options?.rootDir);
2325
this.tagName = options?.tagName ?? '';
2426
this.title = options?.title ?? Manifest.prettyTag(this.tagName);
2527
this.docsTemplatePath = options?.docsTemplatePath;
2628
this.summary = this.manifest.getSummary(this.tagName);
2729
this.description = this.manifest.getDescription(this.tagName);
28-
const aliased = options?.aliases?.[this.tagName] ?? this.tagName.replace(/^\w+-/, '');
30+
const prefix = `${config.tagPrefix.replace(/-$/, '')}-`;
31+
const aliased = config.aliases[this.tagName] ?? this.tagName.replace(prefix, '');
2932
this.slug = slugify(aliased, { strict: true, lower: true });
3033
}
3134
}

0 commit comments

Comments
 (0)