Skip to content

Conversation

asafashirov
Copy link
Contributor

@asafashirov asafashirov commented Oct 9, 2025

Summary

  • Fixed FAQ schema answer text extraction bug where trim function was being misused in pipeline mode
  • Expanded FAQ schema coverage from 5 pages to 46+ pages by including what-is pages
  • Implemented context-aware H3 detection to prevent non-question section headers from being treated as FAQ questions
  • Removed 9 unused legacy schema template files

Changes

  • Replace buggy pipeline usage of trim with proper function call syntax using trim $var \" \\t\\n\\r\" (7 instances)
  • Expand FAQ schema coverage to what-is pages and remove restrictive type checking
  • Add context-aware logic: FAQ pages treat all H3s as questions, other pages require H3 to end with ?
  • Delete unused course-entity.html collector and 8 legacy content schema files

Technical Details

The bug was caused by incorrect usage of Hugo's trim function. When used in pipeline mode with a cutset parameter, it was returning the cutset string itself ("\t\n\r") instead of the trimmed content. Fixed by using proper function call syntax: trim (expression) \" \\t\\n\\r\".

The FAQ structured data was generating empty answer text (just '\t\n\r')
for all FAQ pages, causing Google Search Console validation errors.

The issue was with Hugo's trim function when used in pipeline mode with
the cutset ' \t\n\r' - it was returning the cutset itself instead of the
trimmed text.

Solution: Replace all instances of 'trim " \t\n\r"' with
'strings.TrimSpace' which properly trims whitespace characters.

This fixes the 'Missing field "text" (in "mainEntity.acceptedAnswer")'
error reported by Google Search Console.
Previously, FAQ schema was limited to 'docs' type pages with /faq in URL
or 'faq' in title. This was too restrictive and missed valuable Q&A content.

Changes:
- Remove 'docs' type restriction to capture Q&A content anywhere
- Add support for 'what-is' pages (41 pages with consistent Q&A format)
- Add detection for pages with 'frequently asked' in title
- Maintain support for existing FAQ pages

This expansion allows FAQ structured data to appear on:
- 5 existing FAQ pages (already working)
- 41 what-is pages (newly added)
- Any future pages with FAQ/Frequently Asked in title

Benefits:
- Better SEO with rich snippets for question-based searches
- Improved discovery through Google's 'People also ask' features
- Better machine readability for AI/LLM tools
- More comprehensive Q&A coverage across the site
Previously, ALL H3 headers were treated as questions, causing non-question
section headers to be incorrectly included in FAQ structured data.

Changes:
- In FAQ pages (/faq in URL): All H3s treated as questions (backward compatible)
- In other pages: H3 must end with '?' to be a question
- H2 questions still require '?' everywhere (unchanged)

Results:
- FAQ pages: No change, still extract all H3s (9-21 questions)
- What-is IaC: Reduced from 12 to 4 questions (removed false positives)
- What-is Secrets: Reduced from 38 to 18 questions (only real questions)

This ensures FAQ schema only contains actual questions that users might
search for, improving SEO quality and search engine understanding.
Deleted 9 unused schema templates:
- course-entity.html collector (never referenced)
- 8 legacy content schemas (article, blog, code, course, event, howto, product-software, qa)

These files were part of old non-@graph schema implementation and are no longer used.
All current schemas (BlogPosting, HowTo, FAQPage, TechArticle, etc.) continue to work correctly.

Kept course-list.html as it's actively used by tutorials/section.html.

This comment was marked as resolved.

Changed from incorrect pipeline usage of trim to proper function call syntax.
Hugo's trim function requires 2 arguments: the string and the cutset.
Replace all remaining strings.TrimSpace with trim function using proper Hugo syntax
@pulumi-bot
Copy link
Collaborator

@asafashirov asafashirov enabled auto-merge (squash) October 9, 2025 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants