markmckeown commented on code in PR #4923:
URL: https://github.com/apache/polaris/pull/4923#discussion_r3643671964


##########
site/content/in-dev/unreleased/configuration/config-sections/smallrye-polaris_event_listener_kafka.md:
##########
@@ -0,0 +1,52 @@
+---
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+title: smallrye-polaris_event_listener_kafka

Review Comment:
   The AI answer to this:
   
    ```
   In the smallrye-polaris_event_listener_kafka.md file, the title: field in 
the YAML frontmatter is
     generated via a Gradle task and is used by the Hugo static site generator 
to identify the content
     as a "headless bundle" that can be injected into other documentation pages.
   
     Here is exactly how it is generated and used:
   
     1. How it is generated
     The Javadoc Doclet (DocGenDoclet) first generates the raw markdown content 
without any frontmatter,
     saving it to a temporary build directory (build/markdown-docs/). 
   
     Next, the Gradle task copyConfigSectionsToSite (defined in 
tools/config-docs/site/build.gradle.kts)
     runs. It reads those generated files and manually prepends the frontmatter 
before saving them to
     the site content folder.
   
     It uses the file.nameWithoutExtension as the $title parameter:
   
       1 // From tools/config-docs/site/build.gradle.kts
       2   private fun frontMatter(title: String): String =
       3     """---
       4 # (License header omitted for brevity)
       5 title: $title
       6 build:
       7   list: never
       8   render: never
       9 ---
      10 """
     So, for the file smallrye-polaris_event_listener_kafka.md, the title 
injected becomes title:
     smallrye-polaris_event_listener_kafka.
   
     2. How it is used
     The frontmatter contains a very important Hugo configuration:
   
      1 build:
      2   list: never
      3   render: never
     This tells Hugo not to build a standalone web page for this markdown file 
(e.g., you cannot
     navigate directly to /smallrye-polaris_event_listener_kafka/ on the 
website). It is treated as a
     "headless bundle" or a reusable content snippet.
   
     To display this configuration section on the website, a document author 
uses a custom Hugo
     shortcode named include-config-section.html. The author provides the 
title/filename to the
     shortcode like this:
   
      1 {{< include-config-section "smallrye-polaris_event_listener_kafka" >}}
   
     The shortcode (site/layouts/shortcodes/include-config-section.html) then 
uses the provided string
     to look up the page internally:
   
      1 // It builds the path using the string provided (which matches the 
title/filename)
      2 {{- $pagePath = printf 
"/in-dev/unreleased/configuration/config-sections/%s" $sectionName -}}
      3
      4 // It fetches the page from Hugo's internal site context and renders 
its raw markdown
      5 {{- with site.GetPage $pagePath -}}
      6   {{- .RawContent | $.Page.RenderString -}}
   
     Summary: The title acts as the unique identifier for the generated 
configuration snippet, allowing
     the Hugo site builder to look it up and embed the generated markdown 
tables into broader,
     hand-written documentation pages.
   
   ```
   
   @ConfigMapping is used to find things to turn into markdown. The "prefix" 
declared in @ConfigMapping, in this case "polaris.event-listener.kafka", is 
used in the filename after converting "-" and "." to "_", DocGenDoclet prepends 
"smallrye-" and appends ".md" to generate the filename. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to