Quantcast
Channel: [SOLVED] Eliminate xml suffix | Custom RSS URI
Viewing all articles
Browse latest Browse all 11

[SOLVED] Eliminate xml suffix | Custom RSS URI

$
0
0

No I will not live with the missing xml declaration in my custom RSS feed!

Naturally Go Templates showed its ugly teeth once again.

As soon as I included <?xml version="1.0" encoding="utf-8" standalone="yes" ?> in my list.xml the first charset “<” became “&lt ;”, and made the XML unreadable. Exactly as reported over here: https://stackoverflow.com/questions/32333279/golang-template-escape-first-char

I was having none of this weirdness, so Hugo Template Functions to the rescue!

Simply made a partial called declaration.html its contents are just the xml declaration from above.

And then in my list.xml I called it like this:
{{ partial "declaration" . | htmlUnescape | safeHTML }}

Now the Custom RSS renders as HTML in Firefox! Identical to Hugo’s default RSS.

(I feel like I’m on my way to becoming a Hugo guru) :nerd_face:

Read full topic


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles



Latest Images