Current section
36 Versions
Jump to
Current section
36 Versions
Compare versions
6
files changed
+25
additions
-9
deletions
| @@ -3,10 +3,9 @@ | |
| 3 3 | {<<"description">>,<<"Generating sitemap.xml">>}. |
| 4 4 | {<<"elixir">>,<<">= 1.0.0">>}. |
| 5 5 | {<<"files">>, |
| 6 | - [<<"lib/erl_crash.dump">>,<<"lib/sitemap.ex">>, |
| 7 | - <<"lib/sitemap/adapters/file.ex">>,<<"lib/sitemap/adapters/s3.ex">>, |
| 8 | - <<"lib/sitemap/adapters/string.ex">>,<<"lib/sitemap/builders/file.ex">>, |
| 9 | - <<"lib/sitemap/builders/indexfile.ex">>, |
| 6 | + [<<"lib/sitemap.ex">>,<<"lib/sitemap/adapters/file.ex">>, |
| 7 | + <<"lib/sitemap/adapters/s3.ex">>,<<"lib/sitemap/adapters/string.ex">>, |
| 8 | + <<"lib/sitemap/builders/file.ex">>,<<"lib/sitemap/builders/indexfile.ex">>, |
| 10 9 | <<"lib/sitemap/builders/indexurl.ex">>,<<"lib/sitemap/builders/url.ex">>, |
| 11 10 | <<"lib/sitemap/config.ex">>,<<"lib/sitemap/consts.ex">>, |
| 12 11 | <<"lib/sitemap/define.ex">>,<<"lib/sitemap/dsl.ex">>, |
| @@ -23,4 +22,4 @@ | |
| 23 22 | [{<<"app">>,<<"xml_builder">>}, |
| 24 23 | {<<"optional">>,false}, |
| 25 24 | {<<"requirement">>,<<">= 0.0.0">>}]}]}. |
| 26 | - {<<"version">>,<<"0.1.3">>}. |
| 25 | + {<<"version">>,<<"0.5.0">>}. |
unknownlib/erl_crash.dump
File is too large to be displayed (100 KB limit).
| @@ -10,7 +10,7 @@ defmodule Sitemap do | |
| 10 10 | worker(Sitemap.Config, [], restart: :transient), |
| 11 11 | worker(Sitemap.Builders.File, [], restart: :permanent), |
| 12 12 | worker(Sitemap.Builders.Indexfile, [], restart: :permanent), |
| 13 | - worker(Sitemap.Namer, [:indexfile], id: :namer_indexfile, restart: :permanent), |
| 13 | + worker(Sitemap.Namer, [:indexfile], id: :namer_indexfile, restart: :permanent), |
| 14 14 | worker(Sitemap.Namer, [:file, [zero: 1, start: 2]], id: :namer_file, restart: :permanent), |
| 15 15 | ] |
| @@ -31,7 +31,7 @@ defmodule Sitemap.Config do | |
| 31 31 | public_path: ow[:public_path] || System.get_env("SITEMAP_PUBLIC_PATH") || Application.get_env(:sitemap, :public_path, "sitemaps/"), |
| 32 32 | adapter: ow[:adapter] || System.get_env("SITEMAP_ADAPTER") || Application.get_env(:sitemap, :adapter, Sitemap.Adapters.File), |
| 33 33 | verbose: ow[:verbose] || System.get_env("SITEMAP_VERBOSE") || Application.get_env(:sitemap, :verbose, true), |
| 34 | - compress: ow[:compress] || System.get_env("SITEMAP_COMPRESS") || Application.get_env(:sitemap, :compress, true), |
| 34 | + compress: ow[:compress] || System.get_env("SITEMAP_COMPRESS") || Application.get_env(:sitemap, :compress, true), |
| 35 35 | create_index: ow[:create_index] || System.get_env("SITEMAP_CREATE_INDEX") || Application.get_env(:sitemap, :create_index, :auto), |
| 36 36 | }) |
| 37 37 | end |
| @@ -2,6 +2,7 @@ defmodule Sitemap.Generator do | |
| 2 2 | alias Sitemap.Namer |
| 3 3 | alias Sitemap.Builders.File, as: FileBuilder |
| 4 4 | alias Sitemap.Builders.Indexfile |
| 5 | + alias Sitemap.Location |
| 5 6 | |
| 6 7 | def add(link, attrs \\ []) do |
| 7 8 | case FileBuilder.add(link, attrs) do |
| @@ -26,7 +27,23 @@ defmodule Sitemap.Generator do | |
| 26 27 | |
| 27 28 | # def group do end |
| 28 29 | |
| 29 | - def ping_search_engines do |
| 30 | + def ping_search_engines(urls \\ []) do |
| 31 | + urls = ~w( |
| 32 | + http://google.com/ping?sitemap= |
| 33 | + http://www.google.com/webmasters/sitemaps/ping?sitemap= |
| 34 | + http://www.bing.com/webmaster/ping.aspx?sitemap= |
| 35 | + http://submissions.ask.com/ping?sitemap= |
| 36 | + ) ++ urls |
| 37 | + |
| 38 | + indexurl = Location.url :indexfile |
| 39 | + |
| 40 | + :application.start(:inets) |
| 41 | + Enum.each urls, fn url -> |
| 42 | + spawn(fn -> |
| 43 | + :httpc.request('#{url}#{indexurl}') |
| 44 | + IO.puts "Successful ping of #{url}#{indexurl}" |
| 45 | + end) |
| 46 | + end |
| 30 47 | end |
| 31 48 | |
| 32 49 | def set_options(options \\ []) do |
Loading more files…