2020-08-12 16:22:42 +02:00
|
|
|
defmodule Mix.Tasks.Mobilizon.SiteMap do
|
|
|
|
@moduledoc """
|
|
|
|
Task to generate a new Sitemap
|
|
|
|
"""
|
|
|
|
use Mix.Task
|
|
|
|
|
2020-10-30 15:16:01 +01:00
|
|
|
import Mix.Tasks.Mobilizon.Common
|
2020-08-12 16:22:42 +02:00
|
|
|
alias Mobilizon.Service.SiteMap
|
|
|
|
alias Mobilizon.Web.Endpoint
|
|
|
|
|
|
|
|
@preferred_cli_env "prod"
|
|
|
|
|
|
|
|
@shortdoc "Generates a new Sitemap"
|
|
|
|
def run(["generate"]) do
|
2020-10-30 15:16:01 +01:00
|
|
|
start_mobilizon()
|
2020-08-12 16:22:42 +02:00
|
|
|
|
|
|
|
with {:ok, :ok} <- SiteMap.generate_sitemap() do
|
2020-10-30 15:16:01 +01:00
|
|
|
shell_info("Sitemap saved to #{Endpoint.url()}/sitemap.xml")
|
2020-08-12 16:22:42 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|