fixed xml &

This commit is contained in:
2022-05-08 19:32:01 -06:00
parent b18c571e50
commit fa1b95a7dd
2 changed files with 6 additions and 2 deletions

View File

@@ -16,7 +16,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fow
*/
import (
"bytes"
"net/http"
"strings"
"text/template"
"github.com/gin-gonic/gin"
@@ -76,9 +78,11 @@ func (bc *BlogController) RSSFeed(c *gin.Context) {
return
}
c.Header("Content-Type", "text/xml")
err = t.Execute(c.Writer, posts)
var rawXml bytes.Buffer
err = t.Execute(&rawXml, posts)
if err != nil {
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
return
}
c.String(http.StatusOK, strings.Replace(rawXml.String(), "&", "&amp;", -1), &gin.H{})
}

View File

@@ -20,7 +20,7 @@
<title>{{$post.Title}}</title>
<pubDate>{{$post.Date}}</pubDate>
<link>https://rawley.xyz/blog/post/{{$post.Url}}</link>
<description></description>
<description>{{$post.Title}}</description>
<author>rawleyfowler@gmail.com</author>
</item>
{{end}}