kaxil opened a new pull request, #1500:
URL: https://github.com/apache/airflow-site/pull/1500

   ## Summary
   
   The blog Atom feed at `/blog/index.xml` has been producing invalid XML since 
it was introduced in #1391, reported in #1490. Three separate issues:
   
   **1. Leading whitespace before XML declaration**
   Hugo strips `{{/* */}}` template comments but preserves surrounding 
newlines. This produced two blank lines before `<?xml?>`, which the XML spec 
requires to be at byte 0. Fixed with Hugo's whitespace-trimming markers (`{{- 
-}}`).
   
   **2. HTML escaping of XML constructs**
   Hugo's `html/template` engine escaped `<?xml` → `&lt;?xml` and `<![CDATA[` → 
`&lt;![CDATA[`. Most browsers/readers partially recovered from this, but the 
feed was technically invalid. Fixed by piping through `safeHTML`.
   
   **3. Relative URLs instead of absolute**
   Since `baseURL = "/"`, `.Permalink` produced relative paths like 
`/blog/common-ai-provider/`. The Atom spec requires absolute URIs in `<link>` 
and `<id>` elements (this was the original request in #223). Added a 
`canonicalBaseURL` site param rather than changing the global `baseURL`, which 
could have unintended side effects across the site.
   
   ## Verification
   
   ```bash
   cd landing-pages/site
   hugo --quiet
   python3 -c "
   import xml.etree.ElementTree as ET
   tree = ET.parse('public/blog/index.xml')
   ns = {'atom': 'http://www.w3.org/2005/Atom'}
   entries = tree.findall('.//atom:entry', ns)
   print(f'Valid XML with {len(entries)} entries')
   link = entries[0].find('atom:link', ns).get('href')
   print(f'Entry link: {link}')
   "
   ```
   
   Output:
   ```
   Valid XML with 37 entries
   Entry link: https://airflow.apache.org/blog/common-ai-provider/
   ```
   
   Closes #1490


-- 
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