From 601c57169aa6af6ad86253ce518bf28ef98b233b Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Mon, 12 Oct 2020 19:54:22 +0200 Subject: [PATCH] Parse published/updated times from micropub request --- micropub.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/micropub.go b/micropub.go index f85bdd0..5f418de 100644 --- a/micropub.go +++ b/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