Skip to content

Commit df25fba

Browse files
committed
DA-1354 fix: update H1 validation logic to allow for no H1 or a single H1, and add logging for generated files with mismatched titles
1 parent eb503b7 commit df25fba

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

test/test-h1s-in-content.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function validateH1MatchesFrontmatterTitle(fileContent, frontmatter, filePath) {
1515
const h1s = findH1sInContent(fileContent);
1616

1717
// Valid if no H1 tags are found
18-
if (h1s.length === 0) {
18+
if (h1s.length === 0 || h1s.length > 1) {
1919
return {
2020
valid: true,
2121
h1s,
@@ -25,6 +25,9 @@ function validateH1MatchesFrontmatterTitle(fileContent, frontmatter, filePath) {
2525

2626
// Check if the single H1 tag matches the expected title
2727
if (h1s[0] !== expectedTitle) {
28+
if (filePath.includes("generated")) {
29+
console.log(filePath, frontmatter, h1s);
30+
}
2831
return {
2932
valid: false,
3033
h1s,

0 commit comments

Comments
 (0)