Skip to content

Commit 2607606

Browse files
committed
fix: ensure that tags are merged by slug
1 parent 98693ae commit 2607606

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/tableau/extensions/tag_extension.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ defmodule Tableau.TagExtension do
128128
permalink = Path.join(permalink, slug)
129129

130130
tag = %{title: tag, permalink: permalink, tag: tag, slug: slug}
131-
Map.update(acc, tag, [post], &[post | &1])
131+
Map.update(acc, slug, %{tag: tag, posts: [post]}, &%{tag: tag, posts: [post | &1.posts]})
132+
end
133+
134+
tags =
135+
for {_slug, %{tag: tag, posts: posts}} <- tags, into: %{} do
136+
{tag, posts}
132137
end
133138

134139
{:ok, Map.put(token, :tags, tags)}

0 commit comments

Comments
 (0)