Skip to content

Repository files navigation

Hex.pm DownloadsInline docs

Plugmap

Plugmap is sitemap generation library for Plug/Phoenix Framework

Installation

Add plugmap to your list of dependencies in mix.exs:

defdepsdo[{:plugmap,"~> 0.3.0"}]end

Usage

Plug

defmoduleSitemapsdousePlugmapimportPlug.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)endendend

Then you can call method Sitemaps.pages(conn) in Plugcall function or in Plug.Router

Phoenix Framework

Controller

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)endendend

Router

get"/sitemap/pages",SitemapsController,:pagesget"/sitemap/items",SitemapsController,:pages_dynamic

More info in documentation

Routemap

  • Cache sitemaps
  • Add news sitemap

About

XML Sitemap generator for Plug / Phoenix Framework

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages