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 (
|
import (
|
||||||
|
"bytes"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -76,9 +78,11 @@ func (bc *BlogController) RSSFeed(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Header("Content-Type", "text/xml")
|
c.Header("Content-Type", "text/xml")
|
||||||
err = t.Execute(c.Writer, posts)
|
var rawXml bytes.Buffer
|
||||||
|
err = t.Execute(&rawXml, posts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.String(http.StatusOK, strings.Replace(rawXml.String(), "&", "&", -1), &gin.H{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<title>{{$post.Title}}</title>
|
<title>{{$post.Title}}</title>
|
||||||
<pubDate>{{$post.Date}}</pubDate>
|
<pubDate>{{$post.Date}}</pubDate>
|
||||||
<link>https://rawley.xyz/blog/post/{{$post.Url}}</link>
|
<link>https://rawley.xyz/blog/post/{{$post.Url}}</link>
|
||||||
<description></description>
|
<description>{{$post.Title}}</description>
|
||||||
<author>rawleyfowler@gmail.com</author>
|
<author>rawleyfowler@gmail.com</author>
|
||||||
</item>
|
</item>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
Reference in New Issue
Block a user