Class: Jekyll::LlmsOutput::IndexBuilder
- Inherits:
-
Object
- Object
- Jekyll::LlmsOutput::IndexBuilder
- Defined in:
- lib/jekyll-llms-output/index_builder.rb
Overview
Builds the body of /llms.txt.
Two modes:
1. Data-driven: site.data[<key>] holds a hash with title / description /
sections. The plugin renders that structure to llmstxt.org format.
2. Auto: no data hash present. The plugin generates one section per
configured collection with a bullet for each document.
llmstxt.org spec we follow:
# Title
> Optional one-line description
## Section heading
- [Title](url): optional description
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(site, options) ⇒ IndexBuilder
constructor
A new instance of IndexBuilder.
Constructor Details
#initialize(site, options) ⇒ IndexBuilder
Returns a new instance of IndexBuilder.
21 22 23 24 |
# File 'lib/jekyll-llms-output/index_builder.rb', line 21 def initialize(site, ) @site = site @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/jekyll-llms-output/index_builder.rb', line 19 def @options end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
19 20 21 |
# File 'lib/jekyll-llms-output/index_builder.rb', line 19 def site @site end |
Instance Method Details
#build ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll-llms-output/index_builder.rb', line 26 def build data_key = ["data"] data_hash = data_key && site.data[data_key.to_s] if data_hash.is_a?(Hash) && data_hash["sections"] render_from_data(data_hash) else render_auto end end |