feat: Ping search engines
This commit is contained in:
parent
94d34abc93
commit
ad3846be2f
2 changed files with 25 additions and 0 deletions
|
@ -15,3 +15,8 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
ping:
|
||||
needs:
|
||||
- "pages:deploy"
|
||||
script:
|
||||
- mix pre_dot_hn.ping
|
||||
|
|
20
lib/mix/tasks/pre_dot_hn/ping.ex
Normal file
20
lib/mix/tasks/pre_dot_hn/ping.ex
Normal file
|
@ -0,0 +1,20 @@
|
|||
defmodule Mix.Tasks.PreDotHn.Ping do
|
||||
use Mix.Task
|
||||
|
||||
@urls [
|
||||
"http://google.com/ping?sitemap=%s",
|
||||
"http://www.bing.com/webmaster/ping.aspx?sitemap=%s"
|
||||
]
|
||||
|
||||
def ping(sitemap_url) do
|
||||
@urls
|
||||
|> Enum.map(fn url ->
|
||||
ping_url = String.replace(url, "%s", sitemap_url)
|
||||
:httpc.request('#{ping_url}')
|
||||
end)
|
||||
end
|
||||
|
||||
def run(_args) do
|
||||
ping("https://pre.hn/sitemap.xml.gz")
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue