   defp parse_title(body, path) do
     default = "Title"
     pattern = title_pattern Article.format(path)
-    if pattern do
-      captured = Regex.named_captures(pattern, body, capture: :first)
-      if captured, do: captured["title"], else: default
+    captured = Regex.named_captures(pattern, body, capture: :first)
+    if captured, do: captured["title"], else: default
+  end
+
+  defp parse_date(body, path) do
+    default = Timex.now
+    pattern = date_pattern Article.format(path)
+    captured = Regex.named_captures(pattern, body, capture: :first)
+    if captured do
+      case Timex.parse(captured["date"], "{YYYY}-{M}-{D}") do
+        {:ok, date} -> date
+        {:error, _} -> default
+      end
     else
       default
     end

    end
  end

  defp is_valid_content(content) do
    is_map(content) and content["encoding"] == "base64" and content["type"] == "file"
  end

      |> Enum.map(&(elem(&1, 1)))
      |> Enum.join
      title = parse_title body, path
      date = parse_date body, path
      article_params = %{body: body, published_at: date, path: path, sha: content["sha"], title: title}
      article = Repo.get_by(Article, family_id: family.id, path: path)
      if is_nil(article), do: article = %Article{author_id: author.id, family_id: family.id}
      Article.changeset(article, article_params)
