|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright © 2018-2020 A Bunch Tell LLC. |
|
|
|
* Copyright © 2018-2021 A Bunch Tell LLC. |
|
|
|
* |
|
|
|
* |
|
|
|
* This file is part of WriteFreely. |
|
|
|
* This file is part of WriteFreely. |
|
|
|
* |
|
|
|
* |
|
|
@ -15,7 +15,7 @@ import ( |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
. "github.com/gorilla/feeds" |
|
|
|
"github.com/gorilla/feeds" |
|
|
|
"github.com/gorilla/mux" |
|
|
|
"github.com/gorilla/mux" |
|
|
|
stripmd "github.com/writeas/go-strip-markdown/v2" |
|
|
|
stripmd "github.com/writeas/go-strip-markdown/v2" |
|
|
|
"github.com/writeas/web-core/log" |
|
|
|
"github.com/writeas/web-core/log" |
|
|
@ -87,11 +87,11 @@ func ViewFeed(app *App, w http.ResponseWriter, req *http.Request) error { |
|
|
|
siteURL += "tag:" + tag |
|
|
|
siteURL += "tag:" + tag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
feed := &Feed{ |
|
|
|
feed := &feeds.Feed{ |
|
|
|
Title: collectionTitle, |
|
|
|
Title: collectionTitle, |
|
|
|
Link: &Link{Href: siteURL}, |
|
|
|
Link: &feeds.Link{Href: siteURL}, |
|
|
|
Description: coll.Description, |
|
|
|
Description: coll.Description, |
|
|
|
Author: &Author{author, ""}, |
|
|
|
Author: &feeds.Author{author, ""}, |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -103,13 +103,13 @@ func ViewFeed(app *App, w http.ResponseWriter, req *http.Request) error { |
|
|
|
// Create the item for the feed
|
|
|
|
// Create the item for the feed
|
|
|
|
title = p.PlainDisplayTitle() |
|
|
|
title = p.PlainDisplayTitle() |
|
|
|
permalink = fmt.Sprintf("%s%s", baseUrl, p.Slug.String) |
|
|
|
permalink = fmt.Sprintf("%s%s", baseUrl, p.Slug.String) |
|
|
|
feed.Items = append(feed.Items, &Item{ |
|
|
|
feed.Items = append(feed.Items, &feeds.Item{ |
|
|
|
Id: fmt.Sprintf("%s%s", basePermalinkUrl, p.Slug.String), |
|
|
|
Id: fmt.Sprintf("%s%s", basePermalinkUrl, p.Slug.String), |
|
|
|
Title: title, |
|
|
|
Title: title, |
|
|
|
Link: &Link{Href: permalink}, |
|
|
|
Link: &feeds.Link{Href: permalink}, |
|
|
|
Description: "<![CDATA[" + stripmd.Strip(p.Content) + "]]>", |
|
|
|
Description: "<![CDATA[" + stripmd.Strip(p.Content) + "]]>", |
|
|
|
Content: string(p.HTMLContent), |
|
|
|
Content: string(p.HTMLContent), |
|
|
|
Author: &Author{author, ""}, |
|
|
|
Author: &feeds.Author{author, ""}, |
|
|
|
Created: p.Created, |
|
|
|
Created: p.Created, |
|
|
|
Updated: p.Updated, |
|
|
|
Updated: p.Updated, |
|
|
|
}) |
|
|
|
}) |
|
|
|