1
私はsitemap.xmlを持つアプリケーションを持っています。私は1日1回動的に変更する必要があります。私はそれのためのコンテンツを生成する方法を知っています。しかし、私は実際に私の現在のsitempa.xmlを新しい生成されたsitempa.xml(あるいはその内容)に置き換えることができますか? レールアプリの場合は、内容を置き換えてもうまくいくが、phoenixの場合は違う。フェニックスでsitemap.xmlを動的に生成して提供するにはどうすればよいですか?
sitemap.xmlとを提供するための私のコードは標準的なものである:
defmodule MyApp.Endpoint do
# ................
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :my_app, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt sitemap.xml)
私は「sitemap.xmlと」のための特別なルート/アクションを作成し、コントローラにそれを提供するべきでしょうか?