Sort index entrees per month, by day number; descending

master
Raymon Zutekouw 3 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) post_contents = Enum.concat(post_contents_custom, post_contents_org)
|> Enum.map(fn postMap -> Map.merge(postMap, %{localpath: (constructLocalPath.(postMap))}) end) |> Enum.map(fn postMap -> Map.merge(postMap, %{localpath: (constructLocalPath.(postMap))}) end)
index_file = post_contents index_file =
|> Enum.sort_by(fn m -> Map.get(m, :date) |> (fn d -> Enum.find_index(months, &(&1 == String.slice(d, 8..10))) end).() end) post_contents
|> Enum.sort_by(
&(Map.get(&1, :date)
|> String.slice(5..6)
|> Integer.parse())
)
|> Enum.reverse() |> Enum.reverse()
# Group by month # Group by month
|> Enum.group_by(fn m -> Map.get(m, :date) |> String.slice(8..15) end) |> Enum.group_by(fn m -> Map.get(m, :date) |> String.slice(8..15) end)

Loading…
Cancel
Save