expose jsonfeed
This commit is contained in:
parent
b484f8e50e
commit
d8f2b6f496
|
@ -10,8 +10,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"christine.website/cmd/site/internal/blog"
|
"christine.website/cmd/site/internal/blog"
|
||||||
"christine.website/cmd/site/internal/jsonfeed"
|
|
||||||
"christine.website/cmd/site/internal/middleware"
|
"christine.website/cmd/site/internal/middleware"
|
||||||
|
"christine.website/jsonfeed"
|
||||||
"github.com/gorilla/feeds"
|
"github.com/gorilla/feeds"
|
||||||
"github.com/povilasv/prommod"
|
"github.com/povilasv/prommod"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
@ -194,6 +194,7 @@ func Build() (*Site, error) {
|
||||||
Title: item.Title,
|
Title: item.Title,
|
||||||
DatePublished: item.Date,
|
DatePublished: item.Date,
|
||||||
ContentHTML: string(item.BodyHTML),
|
ContentHTML: string(item.BodyHTML),
|
||||||
|
Tags: item.Tags,
|
||||||
})
|
})
|
||||||
|
|
||||||
smi.Add(&sitemap.URL{
|
smi.Add(&sitemap.URL{
|
||||||
|
|
|
@ -2,22 +2,21 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
||||||
|
|
||||||
package jsonfeed_test
|
package jsonfeed
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"christine.website/cmd/site/internal/jsonfeed"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_ParseSimple(t *testing.T) {
|
func TestParseSimple(t *testing.T) {
|
||||||
r, err := os.Open("testdata/feed.json")
|
r, err := os.Open("testdata/feed.json")
|
||||||
assert.NoError(t, err, "Could not open testdata/feed.json")
|
assert.NoError(t, err, "Could not open testdata/feed.json")
|
||||||
|
|
||||||
feed, err := jsonfeed.Parse(r)
|
feed, err := Parse(r)
|
||||||
assert.NoError(t, err, "Could not parse testdata/feed.json")
|
assert.NoError(t, err, "Could not parse testdata/feed.json")
|
||||||
|
|
||||||
assert.Equal(t, "https://jsonfeed.org/version/1", feed.Version)
|
assert.Equal(t, "https://jsonfeed.org/version/1", feed.Version)
|
Loading…
Reference in New Issue