13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/jekyll/tags/webmentions_head.rb', line 13
def render(context)
head = +"" head << '<link rel="dns-prefetch" href="https://webmention.io">'
head << '<link rel="preconnect" href="https://webmention.io">'
head << '<link rel="preconnect" href="ws://webmention.io:8080">'
page = context["page"]
site = context.registers[:site]
site_url = site.config["url"].to_s
if page["redirect_from"]
if page["redirect_from"].is_a? String
redirect = site_url + page["redirect_from"]
elsif page["redirect_from"].is_a? Array
redirect = site_url + page["redirect_from"].join(",#{site_url}")
end
head << "<meta property=\"webmention:redirected_from\" content=\"#{redirect}\">"
end
username = site.config.dig("webmentions", "username")
if username
head << "<link rel=\"pingback\" href=\"https://webmention.io/#{username}/xmlrpc\">"
head << "<link rel=\"webmention\" href=\"https://webmention.io/#{username}/webmention\">"
end
head
end
|