Sort index entrees per month, by day number; descending

master
Raymon Zutekouw 2 years ago
parent f5b7a30306
commit ff984c7046
Signed by: raymon
GPG Key ID: 0E62222846283925
  1. 9
      client/gen.exs

@ -81,8 +81,13 @@ constructLocalPath = fn p -> dateFolder.(p) <> normalize_title.(Map.get(p, :titl
post_contents = Enum.concat(post_contents_custom, post_contents_org)
|> Enum.map(fn postMap -> Map.merge(postMap, %{localpath: (constructLocalPath.(postMap))}) end)
index_file = post_contents
|> Enum.sort_by(fn m -> Map.get(m, :date) |> (fn d -> Enum.find_index(months, &(&1 == String.slice(d, 8..10))) end).() end)
index_file =
post_contents
|> Enum.sort_by(
&(Map.get(&1, :date)
|> String.slice(5..6)
|> Integer.parse())
)
|> Enum.reverse()
# Group by month
|> Enum.group_by(fn m -> Map.get(m, :date) |> String.slice(8..15) end)

Loading…
Cancel
Save