This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site.git
The following commit(s) were added to refs/heads/main by this push:
new d06ff9500c Fix broken blog Atom feed (#1500)
d06ff9500c is described below
commit d06ff9500c7dd0311d528c3b8857f6f47cb181c4
Author: Kaxil Naik <[email protected]>
AuthorDate: Wed Apr 15 22:11:46 2026 +0100
Fix broken blog Atom feed (#1500)
* Fix broken blog Atom feed (invalid XML) and use absolute URLs
The blog Atom feed has been broken since it was introduced in #1391.
Three issues:
1. Leading whitespace before the XML declaration — Hugo strips
template comments but preserves surrounding newlines, producing
blank lines before <?xml?> which must be at byte 0.
2. HTML escaping of XML constructs — Hugo's html/template engine
escaped <?xml to <?xml and <![CDATA[ to <![CDATA[. Pipe
through safeHTML to emit raw XML.
3. Relative URLs — the Atom spec requires absolute URIs in <link>
and <id> elements. Since baseURL is "/", .Permalink produced
paths like /blog/foo/. Added a canonicalBaseURL site param to
prefix the canonical domain.
Closes #1490
* Address review feedback: use RelPermalink and escape ]]> in CDATA
- Use .RelPermalink instead of .Permalink so that if baseURL is ever
set to an absolute URL, concatenation with canonicalBaseURL won't
produce a double scheme/host.
- Escape ]]> sequences in blog content by splitting the CDATA section,
preventing invalid XML if rendered HTML ever contains that sequence.
---
landing-pages/site/config.toml | 1 +
landing-pages/site/layouts/blog/list.xml | 21 +++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/landing-pages/site/config.toml b/landing-pages/site/config.toml
index eef3e0f1aa..8f2535c135 100644
--- a/landing-pages/site/config.toml
+++ b/landing-pages/site/config.toml
@@ -68,6 +68,7 @@ description = "Platform created by the community to
programmatically author, sch
# Everything below this are Site Params
[params]
+canonicalBaseURL = "https://airflow.apache.org"
charset = "utf-8"
copyright = "The Apache Software Foundation"
privacy_policy = "https://policies.google.com/privacy"
diff --git a/landing-pages/site/layouts/blog/list.xml
b/landing-pages/site/layouts/blog/list.xml
index 2675e0d79e..5ac5deecea 100644
--- a/landing-pages/site/layouts/blog/list.xml
+++ b/landing-pages/site/layouts/blog/list.xml
@@ -1,4 +1,4 @@
-{{/*
+{{- /*
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
@@ -15,14 +15,14 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-*/}}
-
-<?xml version="1.0" encoding="utf-8"?>
+*/ -}}
+{{- $base := .Site.Params.canonicalBaseURL | default "" -}}
+{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ .Site.Title }} Blog</title>
- <link href="{{ .Permalink }}" rel="alternate"/>
-<link href="{{ .Permalink }}index.xml" rel="self" type="application/atom+xml"/>
-<id>{{ .Permalink }}</id>
+ <link href="{{ $base }}{{ .RelPermalink }}" rel="alternate"/>
+ <link href="{{ $base }}{{ .RelPermalink }}index.xml" rel="self"
type="application/atom+xml"/>
+ <id>{{ $base }}{{ .RelPermalink }}</id>
{{ $pages := sort .Pages "Lastmod" "desc" }}
{{ with index $pages 0 }}
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z" }}</updated>
@@ -30,14 +30,15 @@
{{ range sort .Pages "Lastmod" "desc" }}
<entry>
<title>{{ .Title }}</title>
- <link href="{{ .Permalink }}" rel="alternate"/>
- <id>{{ .Permalink }}</id>
+ <link href="{{ $base }}{{ .RelPermalink }}" rel="alternate"/>
+ <id>{{ $base }}{{ .RelPermalink }}</id>
<published>{{ .PublishDate.Format "2006-01-02T15:04:05Z" }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z" }}</updated>
<author>
<name>Apache Airflow</name>
</author>
- <content type="html"><![CDATA[{{ .Content }}]]></content>
+ {{- $content := replace .Content "]]>" "]]]]><![CDATA[>" -}}
+ <content type="html">{{ printf "<![CDATA[%s]]>" $content | safeHTML
}}</content>
</entry>
{{ end }}
</feed>