kiln 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16e0dc4e5feadd3bf854b8bfec84c9973a97a899995aa4f28894e416672d845e
4
- data.tar.gz: b1931b450833b2ca947b67aac41d9254c1ec45fe9e90d2b7b3658d3818e9f5a9
3
+ metadata.gz: b5769fc8686c82a97194dbf3704c7e46b32fccd599d9a0af64680e7e6599079f
4
+ data.tar.gz: e08bf6dd11727a3273d54347a45e9d3493d9ef333c85301cbfe37a70025c99b0
5
5
  SHA512:
6
- metadata.gz: fe15eafda9dd8baa902fc6060326328d620dd2c2bd12fbcba337e34ba6e98e10e0454e58ddb7b7151e93e175288e4c9ba17372ae846e9b7d8d0b02f603c55369
7
- data.tar.gz: 96b38b16497f0d43ca07ddd23d3fcd207d6eee5de3d90e274e31cbf1f6d7e1fa98754f621a06ebd34c857adc25e8e3108003322058cbec92006f804e911eb3ed
6
+ metadata.gz: 0b479bfb6d6b644b7dd1a36dbc1572cf73351b7575f41e008abf57c846c472ac48ca3f00b237e61bc8da41c8b212ff74bb52100062e7c9ce5da0dfad158e4561
7
+ data.tar.gz: 681aca4de196497241120cd95288b81dfeae61faabe7b21d5314a180066bdf6772de5c89195d9bdf97a70a7976154d9fac906ebeffac3849e07708f34360af8d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1 (2026-11-15)
4
+
5
+ Added:
6
+
7
+ - When `url` is set, the build writes `robots.txt`, which allows every crawler and points to
8
+ `sitemap.xml`. A `robots.txt` from a route or `public/` is kept instead.
9
+
3
10
  ## 0.2.0 (2026-11-15)
4
11
 
5
12
  Breaking:
data/lib/kiln/build.rb CHANGED
@@ -111,7 +111,7 @@ module Kiln
111
111
  write_files
112
112
  writer.copy_public(app.root.join("public"), generated: generated_files)
113
113
  Redirects.new(@redirects, host: config.host).write(writer) if @redirects.any?
114
- Sitemap.new(manifest, url: config.url).write(writer) if config.url
114
+ write_sitemap if config.url
115
115
  write_cname if config.cname
116
116
  end
117
117
 
@@ -131,6 +131,13 @@ module Kiln
131
131
  [ ("404.html" if config.not_found), ("CNAME" if config.cname), *config.files.keys.map(&:to_s) ].compact
132
132
  end
133
133
 
134
+ # A robots.txt from a route or public/ is the app's own and stays as it is.
135
+ def write_sitemap
136
+ sitemap = Sitemap.new(manifest, url: config.url)
137
+ sitemap.write(writer)
138
+ sitemap.write_robots(writer) unless @stage.join(Sitemap::ROBOTS).exist?
139
+ end
140
+
134
141
  # config.cname = true takes the host from config.url.
135
142
  def write_cname
136
143
  host = config.cname == true ? config.url && URI(config.url).host : config.cname
data/lib/kiln/sitemap.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "erb"
2
2
 
3
3
  module Kiln
4
- # sitemap.xml with every indexable HTML page in the manifest.
4
+ # sitemap.xml with every indexable HTML page in the manifest, and a robots.txt that points to it.
5
5
  class Sitemap
6
6
  FILENAME = "sitemap.xml"
7
+ ROBOTS = "robots.txt"
7
8
 
8
9
  def self.noindex?(response, body)
9
10
  return false unless response.html?
@@ -34,5 +35,10 @@ module Kiln
34
35
  #{urls.join}</urlset>
35
36
  XML
36
37
  end
38
+
39
+ # robots.txt that allows everything and points crawlers at the sitemap.
40
+ def write_robots(writer)
41
+ writer.write_file(ROBOTS, "User-agent: *\nAllow: /\n\nSitemap: #{@url}/#{FILENAME}\n")
42
+ end
37
43
  end
38
44
  end
data/lib/kiln/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kiln
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiln
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Afonso