Class: Jekyll::MastodonWebfinger::Generator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll/mastodon_webfinger/generator.rb

Overview

A Jekyll Generator that creates a ‘/.well-known/webfinger` file in the site output that points to your Mastodon identity

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jekyll/mastodon_webfinger/generator.rb', line 8

def generate(site)
  destination = site.config["destination"]
  mastodon = site.config["mastodon"]
  return unless mastodon && mastodon["username"] && mastodon["instance"]

  username = mastodon["username"]
  instance = mastodon["instance"]

  directory = create_directory(destination)
  write_webfinger_file(directory, username, instance)
end