Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nerdslabs/plugmap
XML Sitemap generator for Plug / Phoenix Framework
https://github.com/nerdslabs/plugmap
Last synced: 2 months ago
JSON representation
XML Sitemap generator for Plug / Phoenix Framework
- Host: GitHub
- URL: https://github.com/nerdslabs/plugmap
- Owner: nerdslabs
- License: mit
- Created: 2017-07-12T09:59:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-15T13:10:47.000Z (over 7 years ago)
- Last Synced: 2024-10-08T17:53:57.018Z (3 months ago)
- Language: Elixir
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-elixir - plugmap - Plugmap is sitemap generation library for Plug/Phoenix Framework. [Doc](https://hexdocs.pm/plugmap/readme.html) (Utilities)
- awesome-elixir - plugmap - Plugmap is sitemap generation library for Plug/Phoenix Framework. (Utilities)
README
[![Hex.pm Downloads](https://img.shields.io/hexpm/dt/plugmap)](https://hex.pm/packages/plugmap)
[![Inline docs](http://inch-ci.org/github/nerdslabs/plugmap.svg)](http://inch-ci.org/github/nerdslabs/plugmap)# Plugmap
**Plugmap is sitemap generation library for Plug/Phoenix Framework**
## Installation
Add `plugmap` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:plugmap, "~> 0.3.0"}]
end
```## Usage
### Plug
```elixir
defmodule Sitemaps do
use Plugmap
import Plug.Conndefsitemap :pages do
static do
page "https://website.com", changefreq: "daily", priority: 1.0
page "https://website.com/page", changefreq: "monthly", priority: 0.5
end
enddefsitemap :pages_dynamic do
dynamic do
Enum.reduce(1..10, [], fn(x, acc) ->
item = page "https://website.com", changefreq: "daily", priority: x/10
[item | acc]
end)
end
end
end
```
Then you can call method ```Sitemaps.pages(conn)``` in ```Plug``` ```call``` function or in ```Plug.Router```### Phoenix Framework
#### Controller
```elixir
defmodule SomeApp.SitemapsController do
use SomeApp.Web, :controller
use Plugmapdefsitemap :pages do
static do
page "https://website.com", changefreq: "daily", priority: 1.0
page "https://website.com/page", changefreq: "monthly", priority: 0.5
end
enddefsitemap :pages_dynamic do
dynamic do
Enum.reduce(1..10, [], fn(x, acc) ->
item = page "https://website.com", changefreq: "daily", priority: x/10
[item | acc]
end)
end
endend
```
#### Router
```elixir
get "/sitemap/pages", SitemapsController, :pages
get "/sitemap/items", SitemapsController, :pages_dynamic
```More info in [documentation](https://hexdocs.pm/plugmap/Plugmap.DSL.html)
## Routemap
- [ ] Cache sitemaps
- [ ] Add news sitemap