     |> Path.join("sitemap.xml.eex")
 
   EEx.function_from_file(:defp, :sitemap_xml, sitemap_path, [
-    :all_posts,
+    :pages,
+    :posts,
     :transformer,
     :server_root
   ])
+
+  @spec create_file(binary(), [Page.t()], [Post.t()]) :: Serum.File.t()
+  defp create_file(dest, pages, posts) do
+    %Serum.File{
+      dest: Path.join(dest, "sitemap.xml"),
+      out_data: sitemap_xml(pages, posts, &to_w3c_format/1, get_server_root())
+    }
+  end
 
   defp to_w3c_format(erl_datetime) do
     # reference to https://www.w3.org/TR/NOTE-datetime

    |> GlobalBindings.get()
    |> Map.fetch!(:server_root)
  end

  @spec write_sitemap(binary()) :: Result.t(Serum.File.t())
  defp write_sitemap(dest) do
    all_posts = GlobalBindings.get(:all_posts)

    file = %Serum.File{
      dest: Path.join(dest, "sitemap.xml"),
      out_data: sitemap_xml(all_posts, &to_w3c_format/1, get_server_root())
    }

    Serum.File.write(file)
  end
end


  require EEx
  alias Serum.GlobalBindings
  alias Serum.Page
  alias Serum.Post

  def name, do: "Create sitemap for search engine"
  def version, do: "1.1.0"
