mirror of https://github.com/jlelse/GoBlog
Parse published/updated times from micropub request
This commit is contained in:
parent
f2dc532334
commit
601c57169a
12
micropub.go
12
micropub.go
|
@ -91,6 +91,12 @@ func convertMPValueMapToPost(values map[string][]string) (*Post, error) {
|
|||
if content, ok := values["content"]; ok {
|
||||
entry.Content = content[0]
|
||||
}
|
||||
if published, ok := values["published"]; ok {
|
||||
entry.Published = published[0]
|
||||
}
|
||||
if updated, ok := values["updated"]; ok {
|
||||
entry.Updated = updated[0]
|
||||
}
|
||||
// Parameter
|
||||
if name, ok := values["name"]; ok {
|
||||
entry.Parameters["title"] = name
|
||||
|
@ -163,6 +169,12 @@ func convertMPMfToPost(mf *microformatItem) (*Post, error) {
|
|||
if mf.Properties != nil && len(mf.Properties.Content) == 1 && len(mf.Properties.Content[0]) > 0 {
|
||||
entry.Content = mf.Properties.Content[0]
|
||||
}
|
||||
if len(mf.Properties.Published) == 1 {
|
||||
entry.Published = mf.Properties.Published[0]
|
||||
}
|
||||
if len(mf.Properties.Updated) == 1 {
|
||||
entry.Updated = mf.Properties.Updated[0]
|
||||
}
|
||||
// Parameter
|
||||
if len(mf.Properties.Name) == 1 {
|
||||
entry.Parameters["title"] = mf.Properties.Name
|
||||
|
|
Loading…
Reference in New Issue