Sort index entrees per month, by day number; descending
This commit is contained in:
+7
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user