Sitemaps.DSL (Sitemaps v0.1.2)

Copy Markdown View Source

The DSL is the implementation of the most important part of this project, it's going to help you to define the pages to be included in the sitemap.

As an example, you can see in the README.md file this example:

defmodule MyApp.Sitemaps do
  use Sitemaps

  def generate do
    create do
      # list each URL that should be included
      add "path1", priority: 0.5, changefreq: "hourly", expires: nil, mobile: true
      # ...
    end

    # notify search engines (currently Google and Bing) of the updated sitemap
    ping()
  end
end

Adding use Sitemaps in the beginning of the module you choose for setting your sitemap it will add some stuff that will let you use the create/1 macros and other functions like ping/0.

Summary

Functions

Same as create/2 but without specifying options.

Let you define the sitemap. It's creating the environment where you could use add/2 as many times as you need. In this case you can specify actions before starting with the block. These options are the same as you can see in the Sitemaps.Config module.

Functions

create(contents)

(macro)

Same as create/2 but without specifying options.

create(options, contents)

(macro)

Let you define the sitemap. It's creating the environment where you could use add/2 as many times as you need. In this case you can specify actions before starting with the block. These options are the same as you can see in the Sitemaps.Config module.