Plugmap v0.2.0 Plugmap.DSL View Source

This is the DSL sitemap module.

Link to this section Summary

Functions

Create function which generate sitemap xml

Add page to sitemap

Add page with attributes to sitemap

Link to this section Functions

Link to this macro defsitemap(name, contents) View Source (macro)

Create function which generate sitemap xml.

Returns Plug.Conn with sitemap and text/xml content type.

Example static pages

defsitemap :pages do
    static do
        page "https://test.com", changefreq: "monthly", priority: 0.7
        page "https://test.com/list", changefreq: "daily", priority: 1.0
    end
end

Example dynamic pages

defsitemap :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

It must return list of items generated with page function

Add page to sitemap.

Examples

page "https://test.com"

Add page with attributes to sitemap.

Examples

page "https://test.com", changefreq: "monthly", priority: 0.7