Invalid RSS feed: blank lines at start of file

My automatically generated RSS feed (index.xml) always generates with 4 blank lines at the top of the file. This results in the following error when trying to open the feed in Chrome:

error on line 5 at column 6: XML declaration allowed only at the start of the document

Any idea what’s causing these blank lines to show up, and how to stop them?

Source on github
Published site source on github

Ah, as usual I figured out the problem soon after I posted a question about it.

In my theme’s rss.xml, the shortcode at the top was creating newlines.
By adding a hyphen to the end of the shortcodes, I was able to suppress the newlines:

{{ if ne .Title site.Title -}}
{{ printf "%s " .Title | .Scratch.Set "title" -}}
{{ else -}}
{{ .Scratch.Set "title" nil -}}
{{ end -}}
{{ $baseCSS := resources.Get "css/base.css" | resources.ExecuteAsTemplate "css/base.css" . | minify | fingerprint -}}