fixed xml &
This commit is contained in:
@@ -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(), "&", "&", -1), &gin.H{})
|
||||
}
|
||||
|
||||
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user