bridgetown-sitemap 3.0.0 → 3.0.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: ea58bca8a2a06f1b598f9332323f91fb29891ca412339969f2d120d095bad4b4
4
- data.tar.gz: b3bd5cd474d8f9a8c1134b32dbdcbba529b86139c3f5c309f4a015483323b33a
3
+ metadata.gz: e3861b442e826131e4785cbe018f823f909d5186d3ce469ada13d969c7c43f44
4
+ data.tar.gz: f435969e4c250eeb04650029388de9f15dcd9455f6376d808dbe1e72ba7dc421
5
5
  SHA512:
6
- metadata.gz: e352891416d845e32acfa8531e23478e69c86ece42221bd72d144f2df42e2281671522654d1988ded89d21c4c0b6c15464fdb07c6256f26610a562db19e1a52e
7
- data.tar.gz: 9b24215ee863c2a0dbfd271921f6ee7fa462edb8301340d3455d5325d7b8e5a6af8c2b856fea78b40e2cdb501ecafbf5b713bd2495aee93b434e9bb9112851b1
6
+ metadata.gz: ef07dcbbcdbbbbe707ea88e03ae9563863ad8a5ea93d3f057d01e54b3cb84b1d6f6eb7d69d45340a76ba2aada1faad626a7e671ee9822bcfadf22647a7450201
7
+ data.tar.gz: 6da9dfa17c7d4c56e6a4321f21cfbff872ae3684cd90a1282854679c44482377a20e78d00ec36d58519dbdebf60b2f990e527c2da4c7866baf651ddf46ce29c6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # main
2
2
 
3
+ # 3.0.1 / 24-12-2025
4
+
5
+ * Remove uses of `.present?`
6
+
3
7
  # 3.0.0 / 24-02-2025
4
8
 
5
9
  * Add i18n support
@@ -42,6 +42,7 @@ module BridgetownSitemap
42
42
  site_map.data.layout = "none"
43
43
  site_map.data.static_files = static_files
44
44
  site_map.data.xsl = file_exists?("sitemap.xsl")
45
+ site_map.data.custom_urls = @site.config.dig("sitemap", "custom_urls") || []
45
46
  site_map
46
47
  end
47
48
 
@@ -14,7 +14,7 @@ module BridgetownSitemap
14
14
  `git log -1 --pretty="format:%cI" "#{@resource.path}"`
15
15
  end
16
16
 
17
- Time.parse(date) if date.present?
17
+ Time.parse(date) if !date.nil? && date.size > 0
18
18
  end
19
19
 
20
20
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownSitemap
4
- VERSION = "3.0.0"
4
+ VERSION = "3.0.1"
5
5
  end
data/lib/sitemap.erb CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
 
3
- <% if page.data.xsl.present? %>
3
+ <% if !page.data.xsl.nil? %>
4
4
  <?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>
5
5
  <% end %>
6
6
 
@@ -82,4 +82,17 @@
82
82
  <% end %>
83
83
  </url>
84
84
  <% end %>
85
+
86
+ <% page.data.custom_urls.each do |custom_url| %>
87
+ <url>
88
+ <loc><%= xml_escape custom_url["url"] %></loc>
89
+ <lastmod><%= custom_url["lastmod"] || Time.now.localtime.xmlschema %></lastmod>
90
+ <% if custom_url["changefreq"] %>
91
+ <changefreq><%= custom_url["changefreq"] %></changefreq>
92
+ <% end %>
93
+ <% if custom_url["priority"] %>
94
+ <priority><%= custom_url["priority"] %></priority>
95
+ <% end %>
96
+ </url>
97
+ <% end %>
85
98
  </urlset>
data/test/test_sitemap.rb CHANGED
@@ -237,4 +237,20 @@ class TestSitemap < BridgetownSitemap::Test
237
237
  assert_match %r!<loc>https://example.com/new/</loc>!, @sitemap
238
238
  end
239
239
  end
240
+
241
+ describe "rendering the site with custom URLs" do
242
+ before(:all) do
243
+ prepare_site
244
+ @config["sitemap"] = { "custom_urls" => [{ "url" => "https://example.com/custom-url", "priority" => 0.9, "changefreq" => "weekly" }] }
245
+ process_site
246
+
247
+ @sitemap = File.read(dest_dir("sitemap.xml"))
248
+ end
249
+
250
+ it "includes custom URLs in the sitemap" do
251
+ assert_match %r!<loc>https://example.com/custom-url</loc>!, @sitemap
252
+ assert_match %r!<priority>0.9</priority>!, @sitemap
253
+ assert_match %r!<changefreq>weekly</changefreq>!, @sitemap
254
+ end
255
+ end
240
256
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayush Newatia
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-24 00:00:00.000000000 Z
10
+ date: 2025-12-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bridgetown