Class: Jekyll::WebmentionIO::QueueWebmentions

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll/generators/queue_webmentions.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/jekyll/generators/queue_webmentions.rb', line 19

def generate(site)
  @site = site
  @site_url = site.config["url"].to_s
  @syndication = site.config.dig("webmentions", "syndication")

  if @site.config['serving']
    Jekyll::WebmentionIO.log "msg", "Webmentions lookups are not run when running `jekyll serve`."

    @site.config['webmentions'] ||= {}
    @site.config['webmentions']['pause_lookups'] = true
    return
  end

  if @site_url.include? "localhost"
    WebmentionIO.log "msg", "Webmentions lookups are not run on localhost."
    return
  end

  compile_jsonpath_expressions() if ! @syndication.nil?

  WebmentionIO.log "msg", "Collecting webmentions you’ve made. This may take a while."

  upgrade_outgoing_webmention_cache

  posts = WebmentionIO.gather_documents(@site).select { |p| ! p.data["draft"] }
  gather_webmentions(posts)
end