Class: Abqari::LlmsTxt

Inherits:
Object
  • Object
show all
Defined in:
lib/abqari/llms_txt.rb

Overview

llms.txt — opt-in machine-readable summary of the site for LLM crawlers and AI tools. Inverse policy from robots.txt's block_ai_scraping: where robots.txt slams the door on AI training, llms.txt opens a curated front door for AI READERS.

File location: /llms.txt (no .well-known/ prefix in the draft spec at llmstxt.org).

Format (draft spec, kept deliberately minimal):

# <Site Title>

> <one-line summary>

## Posts

- [Title](https://...): one-line description

## Publications

- [Title](https://...): one-line description

Off by default — opt in with llms.enabled: true in config/site.yml. When disabled, no file is written.

Constant Summary collapse

SECTIONS =
%w[posts publications workshops photos].freeze

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ LlmsTxt

Returns a new instance of LlmsTxt.



31
32
33
# File 'lib/abqari/llms_txt.rb', line 31

def initialize(site)
  @site = site
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/abqari/llms_txt.rb', line 35

def enabled?
  @site.config.dig('llms', 'enabled') == true
end

#writeObject



39
40
41
42
# File 'lib/abqari/llms_txt.rb', line 39

def write
  return unless enabled?
  File.write(File.join(@site.output_dir, 'llms.txt'), build)
end