Skip to content

Commit 29f1b31

Browse files
fixup! docs: make sure aio home has a non-ignored h1
fix wrong title being set
1 parent 5391fb5 commit 29f1b31

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

aio/content/marketing/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<!-- CONTAINER -->
1414
<div class="homepage-container">
15-
<h1 class="hero-headline no-toc no-anchor" aria-label="Angular - The modern web developer's platform">The modern web<br>developer's platform</h1>
15+
<h1 class="hero-headline no-title no-toc no-anchor" aria-label="Angular - The modern web developer's platform">The modern web<br>developer's platform</h1>
1616
<a class="button hero-cta no-print" href="start">Get Started</a>
1717
</div>
1818

aio/src/app/layout/doc-viewer/doc-viewer.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class DocViewerComponent implements OnDestroy {
9292
*/
9393
protected prepareTitleAndToc(targetElem: HTMLElement, docId: string): () => void {
9494
const titleEl = targetElem.querySelector('h1');
95+
const noTitle = !!titleEl && /no-?title/i.test(titleEl.className);
9596
const needsToc = !!titleEl && !/no-?toc/i.test(titleEl.className);
9697
const embeddedToc = targetElem.querySelector('aio-toc.embedded');
9798

@@ -112,7 +113,9 @@ export class DocViewerComponent implements OnDestroy {
112113
// Only create ToC for docs with an `<h1>` heading.
113114
// If you don't want a ToC, add "no-toc" class to `<h1>`.
114115
if (titleEl) {
115-
title = (typeof titleEl.innerText === 'string') ? titleEl.innerText : titleEl.textContent;
116+
if(!noTitle) {
117+
title = (typeof titleEl.innerText === 'string') ? titleEl.innerText : titleEl.textContent;
118+
}
116119

117120
if (needsToc) {
118121
this.tocService.genToc(targetElem, docId);

0 commit comments

Comments
 (0)