Add support for series
parent
d747ceddf3
commit
9027f6734b
6
entry.go
6
entry.go
|
@ -20,6 +20,7 @@ type Entry struct {
|
||||||
lastmod string
|
lastmod string
|
||||||
section string
|
section string
|
||||||
tags []string
|
tags []string
|
||||||
|
series []string
|
||||||
link string
|
link string
|
||||||
slug string
|
slug string
|
||||||
replyLink string
|
replyLink string
|
||||||
|
@ -210,6 +211,9 @@ func computeExtraSettings(entry *Entry) error {
|
||||||
} else if strings.HasPrefix(text, "tags: ") {
|
} else if strings.HasPrefix(text, "tags: ") {
|
||||||
// Tags
|
// Tags
|
||||||
entry.tags = strings.Split(strings.TrimPrefix(text, "tags: "), ",")
|
entry.tags = strings.Split(strings.TrimPrefix(text, "tags: "), ",")
|
||||||
|
} else if strings.HasPrefix(text, "series: ") {
|
||||||
|
// Series
|
||||||
|
entry.series = strings.Split(strings.TrimPrefix(text, "series: "), ",")
|
||||||
} else if strings.HasPrefix(text, "link: ") {
|
} else if strings.HasPrefix(text, "link: ") {
|
||||||
// Link
|
// Link
|
||||||
entry.link = strings.TrimPrefix(text, "link: ")
|
entry.link = strings.TrimPrefix(text, "link: ")
|
||||||
|
@ -334,4 +338,4 @@ func WriteEntry(entry *Entry) (location string, err error) {
|
||||||
}
|
}
|
||||||
location = entry.location
|
location = entry.location
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
4
post.go
4
post.go
|
@ -11,6 +11,7 @@ type HugoFrontMatter struct {
|
||||||
Published string `yaml:"date,omitempty"`
|
Published string `yaml:"date,omitempty"`
|
||||||
Updated string `yaml:"lastmod,omitempty"`
|
Updated string `yaml:"lastmod,omitempty"`
|
||||||
Tags []string `yaml:"tags,omitempty"`
|
Tags []string `yaml:"tags,omitempty"`
|
||||||
|
Series []string `yaml:"series,omitempty"`
|
||||||
ExternalURL string `yaml:"externalURL,omitempty"`
|
ExternalURL string `yaml:"externalURL,omitempty"`
|
||||||
IndieWeb HugoFrontMatterIndieWeb `yaml:"indieweb,omitempty"`
|
IndieWeb HugoFrontMatterIndieWeb `yaml:"indieweb,omitempty"`
|
||||||
Syndicate []string `yaml:"syndicate,omitempty"`
|
Syndicate []string `yaml:"syndicate,omitempty"`
|
||||||
|
@ -40,6 +41,7 @@ func writeFrontMatter(entry *Entry) (string, error) {
|
||||||
Published: entry.date,
|
Published: entry.date,
|
||||||
Updated: entry.lastmod,
|
Updated: entry.lastmod,
|
||||||
Tags: entry.tags,
|
Tags: entry.tags,
|
||||||
|
Series: entry.series,
|
||||||
ExternalURL: entry.link,
|
ExternalURL: entry.link,
|
||||||
IndieWeb: HugoFrontMatterIndieWeb{
|
IndieWeb: HugoFrontMatterIndieWeb{
|
||||||
Reply: HugoFrontMatterReply{
|
Reply: HugoFrontMatterReply{
|
||||||
|
@ -77,4 +79,4 @@ func WriteHugoPost(entry *Entry) (string, error) {
|
||||||
buff.WriteString(f)
|
buff.WriteString(f)
|
||||||
buff.WriteString(entry.content)
|
buff.WriteString(entry.content)
|
||||||
return buff.String(), nil
|
return buff.String(), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue