Module: JekyllAeo::Generators::DomainProfile

Defined in:
lib/jekyll-aeo/generators/domain_profile.rb

Constant Summary collapse

SPEC_URL =
"https://ai-domain-data.org/spec/v0.1"
VALID_ENTITY_TYPES =
%w[
  Organization Person Blog NGO Community
  Project CreativeWork SoftwareApplication Thing
].freeze

Class Method Summary collapse

Class Method Details

.generate(site) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jekyll-aeo/generators/domain_profile.rb', line 16

def self.generate(site)
  config = JekyllAeo::Config.from_site(site)
  return if config["enabled"] == false

  dp_config = config["domain_profile"] || {}
  return if dp_config["enabled"] == false

  profile = build_profile(dp_config, site)
  return unless profile

  output_path = File.join(site.dest, ".well-known", "domain-profile.json")
  FileUtils.mkdir_p(File.dirname(output_path))
  File.write(output_path, "#{JSON.pretty_generate(profile)}\n")
end