feeds

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAtom

func GenerateAtom(posts []*models.Post, config AtomConfig) (string, error)

GenerateAtom generates an Atom 1.0 feed from posts

func GenerateRSS

func GenerateRSS(posts []*models.Post, config RSSConfig) (string, error)

GenerateRSS generates an RSS 2.0 feed from posts

Types

type AtomAuthor

type AtomAuthor struct {
	Name  string `xml:"name"`
	Email string `xml:"email,omitempty"`
}

AtomAuthor represents an Atom author element

type AtomConfig

type AtomConfig struct {
	Title       string
	Link        string
	Description string
	Author      string
	AuthorEmail string
	BlogPath    string
}

AtomConfig contains configuration for Atom feed generation

type AtomContent

type AtomContent struct {
	Type string `xml:"type,attr"`
	Text string `xml:",chardata"`
}

AtomContent represents Atom content element

type AtomEntry

type AtomEntry struct {
	Title   string       `xml:"title"`
	Link    []AtomLink   `xml:"link"`
	ID      string       `xml:"id"`
	Updated string       `xml:"updated"`
	Summary string       `xml:"summary,omitempty"`
	Content *AtomContent `xml:"content,omitempty"`
	Author  *AtomAuthor  `xml:"author,omitempty"`
}

AtomEntry represents an Atom entry (post)

type AtomFeed

type AtomFeed struct {
	XMLName xml.Name    `xml:"feed"`
	XMLNS   string      `xml:"xmlns,attr"`
	Title   string      `xml:"title"`
	Link    []AtomLink  `xml:"link"`
	ID      string      `xml:"id"`
	Updated string      `xml:"updated"`
	Author  *AtomAuthor `xml:"author,omitempty"`
	Entries []AtomEntry `xml:"entry"`
}

AtomFeed represents the root Atom 1.0 feed

type AtomLink struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr,omitempty"`
	Type string `xml:"type,attr,omitempty"`
}

AtomLink represents an Atom link element

type RSS2Channel

type RSS2Channel struct {
	Title         string     `xml:"title"`
	Link          string     `xml:"link"`
	Description   string     `xml:"description"`
	Language      string     `xml:"language,omitempty"`
	Copyright     string     `xml:"copyright,omitempty"`
	LastBuildDate string     `xml:"lastBuildDate,omitempty"`
	PubDate       string     `xml:"pubDate,omitempty"`
	Generator     string     `xml:"generator,omitempty"`
	Items         []RSS2Item `xml:"item"`
}

RSS2Channel represents the RSS channel

type RSS2Feed

type RSS2Feed struct {
	XMLName xml.Name     `xml:"rss"`
	Version string       `xml:"version,attr"`
	Channel *RSS2Channel `xml:"channel"`
}

RSS2Feed represents the root RSS 2.0 feed

type RSS2Item

type RSS2Item struct {
	Title       string `xml:"title"`
	Link        string `xml:"link"`
	Description string `xml:"description"`
	Author      string `xml:"author,omitempty"`
	PubDate     string `xml:"pubDate"`
	GUID        string `xml:"guid"`
}

RSS2Item represents an RSS item (post)

type RSSConfig

type RSSConfig struct {
	Title       string
	Link        string
	Description string
	Language    string
	Copyright   string
	Author      string
	BlogPath    string
}

RSSConfig contains configuration for RSS feed generation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL