moesif-jekyll-llmstxt 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 195e26776c1399f02b430033aa40add9703f3195b1d2d593924f9903a13f7196
4
+ data.tar.gz: e381646c0e45a46fc00dc7656e227b84a5b858257c4c0902bfee35ab57db9c5d
5
+ SHA512:
6
+ metadata.gz: 7ce050aa46f2aa23959f28203b24f3b88e567bcf5255904b5cec45ce19c4400fc8ccba03657f4ffe36a8baa17fc5a5e5daee23766001ac9522ebfdfc376ba218
7
+ data.tar.gz: 368b0570548b52d7288e5f273a116585b204c07b58cebd798367cd9495f3bc5b5fe6c58ea80eb2fb9bf67f91577424f16f8f42ba5b8d6d1d3dc3600d996ecd7a
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Kyle Gao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # jekyll-llmstxt
2
+
3
+ This is a Jekyll plugin that makes your site more LLM-friendly according to the
4
+ spec from [llmstxt.org](https://llmstxt.org). It generates a `/llms.txt` file
5
+ that contains basic information about your site and links to all posts in thei
6
+ raw markdown format.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'jekyll-llmstxt'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install jekyll-llmstxt
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Llmstxt
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
@@ -0,0 +1,60 @@
1
+ require 'jekyll'
2
+
3
+ module Jekyll
4
+ class LLMSGenerator < Generator
5
+ safe true
6
+ priority :low
7
+
8
+ def generate(site)
9
+ # Create llms.txt file at site root
10
+ site.pages << Jekyll::PageWithoutAFile.new(site, site.source, "", "llms.txt").tap do |file|
11
+ file.content = site.config["title"] ? "# #{site.config["title"]}\n\n" : ""
12
+ file.content += site.config["description"] ? "#{site.config["description"]}\n\n" : ""
13
+
14
+ site.collections.each do |collection_name, collection|
15
+ # Check if the collection has any documents
16
+ unless collection.docs.empty?
17
+
18
+ title_cased_name = collection_name.split.map(&:capitalize).join(' ')
19
+ file.content += "## #{title_cased_name}:\n\n"
20
+
21
+ collection.docs.each do |post|
22
+ post_url = site.baseurl ? File.join(site.baseurl, post.url) : post.url
23
+ file.content += "- [#{post.data["title"]}](#{post_url}index.md)\n"
24
+ end
25
+ file.content += "\n\n"
26
+ end
27
+ end
28
+
29
+ file.data["layout"] = nil
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+ class MarkdownPage < Page
36
+ def initialize(site, base, dir, name, content)
37
+ @site = site
38
+ @base = base
39
+ @dir = dir
40
+ @name = name
41
+
42
+ self.process(name)
43
+ self.content = content
44
+ self.data = {
45
+ "layout" => nil, # Set layout if needed, or leave nil
46
+ "title" => "Generated Markdown File",
47
+ }
48
+ end
49
+ end
50
+ end
51
+
52
+ Jekyll::Hooks.register :site, :post_write do |site|
53
+ site.collections.each do |collection_name, collection|
54
+ collection.docs.each do |post|
55
+ target_dir = File.join(site.dest, post.url)
56
+ target_path = File.join(target_dir, "index.md")
57
+ FileUtils.cp(post.path, target_path)
58
+ end
59
+ end
60
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moesif-jekyll-llmstxt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Derric Gilling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description:
62
+ email:
63
+ - derric@moesif.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - README.md
68
+ - LICENSE.txt
69
+ files:
70
+ - LICENSE.txt
71
+ - README.md
72
+ - lib/jekyll-llmstxt.rb
73
+ - lib/jekyll-llmstxt/version.rb
74
+ homepage: https://github.com/Moesif/jekyll-llmstxt
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 2.4.0
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.5.7
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Generate llms.txt for Jekyll site
97
+ test_files: []