Plugmap is sitemap generation library for Plug/Phoenix Framework
Add plugmap to your list of dependencies in mix.exs:
defdepsdo[{:plugmap,"~> 0.3.0"}]enddefmoduleSitemapsdousePlugmapimportPlug.Conndefsitemap:pagesdostaticdopage"https://website.com",changefreq: "daily",priority: 1.0page"https://website.com/page",changefreq: "monthly",priority: 0.5endenddefsitemap:pages_dynamicdodynamicdoEnum.reduce(1..10,[],fn(x,acc)->item=page"https://website.com",changefreq: "daily",priority: x/10[item|acc]end)endendendThen you can call method Sitemaps.pages(conn) in Plugcall function or in Plug.Router
defmoduleSomeApp.SitemapsControllerdouseSomeApp.Web,:controllerusePlugmapdefsitemap:pagesdostaticdopage"https://website.com",changefreq: "daily",priority: 1.0page"https://website.com/page",changefreq: "monthly",priority: 0.5endenddefsitemap:pages_dynamicdodynamicdoEnum.reduce(1..10,[],fn(x,acc)->item=page"https://website.com",changefreq: "daily",priority: x/10[item|acc]end)endendendget"/sitemap/pages",SitemapsController,:pagesget"/sitemap/items",SitemapsController,:pages_dynamicMore info in documentation
- Cache sitemaps
- Add news sitemap