bridgetown-sitemap 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +16 -0
- data/lib/bridgetown-sitemap/version.rb +1 -1
- data/lib/sitemap.erb +18 -0
- data/test/fixtures/src/some-subfolder/test_priority_and_changefreq.html +5 -0
- data/test/test_sitemap.rb +6 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4988c349a0919aefa587882e538bf0623a5c9a994f38aa937edcf6898f644e1d
|
4
|
+
data.tar.gz: d94f6c3d21bc8800f71c038d8615fb6902e61de07b64f8c61c99729a275da104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1752c19b00fb0de0b7f194da1ecbe20f279f6890a51f7ff5f826f4a0d5d3da9c1bbaca4331291d517552fa25ca54ae4a297421819a1fcca40e694ad172ce7e7c
|
7
|
+
data.tar.gz: de70253082a7be05ff85785b1c9ef806ed5c3e62b2fe4e32d616acb0c99dff1e83c50dd4c6b23fd216b50540511d09f2c8cedbdfad49c8d83e9590efa31136df
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,22 @@ The `<lastmod>` tag in the `sitemap.xml` will reflect by priority:
|
|
30
30
|
2. The modified date of the file as reported by `git log`.
|
31
31
|
|
32
32
|
|
33
|
+
## `<priority>` and `<changefreq>` tag
|
34
|
+
You can optionally specify a _priority_ and _change frequency_ for each page in your site by adding the following to the Front Matter of each page:
|
35
|
+
|
36
|
+
```yml
|
37
|
+
sitemap_priority: 0.7
|
38
|
+
sitemap_change_frequency: weekly
|
39
|
+
```
|
40
|
+
|
41
|
+
This will add the following to the `<url>` tag in the `sitemap.xml`:
|
42
|
+
|
43
|
+
```xml
|
44
|
+
<priority>0.7</priority>
|
45
|
+
<changefreq>weekly</changefreq>
|
46
|
+
```
|
47
|
+
|
48
|
+
|
33
49
|
## Exclusions
|
34
50
|
|
35
51
|
If you would like to exclude specific pages from the sitemap set the
|
data/lib/sitemap.erb
CHANGED
@@ -13,6 +13,12 @@
|
|
13
13
|
<url>
|
14
14
|
<loc><%= xml_escape resource.absolute_url %></loc>
|
15
15
|
<lastmod><%= resource.sitemap_last_modified_at.localtime.xmlschema %></lastmod>
|
16
|
+
<% if resource.data.sitemap_priority %>
|
17
|
+
<priority><%= resource.data.sitemap_priority %></priority>
|
18
|
+
<% end %>
|
19
|
+
<% if resource.data.sitemap_change_frequency %>
|
20
|
+
<changefreq><%= resource.data.sitemap_change_frequency %></changefreq>
|
21
|
+
<% end %>
|
16
22
|
</url>
|
17
23
|
<% end %>
|
18
24
|
<% end %>
|
@@ -23,6 +29,12 @@
|
|
23
29
|
<url>
|
24
30
|
<loc><%= xml_escape absolute_url(generated_page.url) %></loc>
|
25
31
|
<lastmod><%= (generated_page.data.last_modified_at || site.time).localtime.xmlschema %></lastmod>
|
32
|
+
<% if generated_page.data.sitemap_priority %>
|
33
|
+
<priority><%= generated_page.data.sitemap_priority %></priority>
|
34
|
+
<% end %>
|
35
|
+
<% if generated_page.data.sitemap_change_frequency %>
|
36
|
+
<changefreq><%= generated_page.data.sitemap_change_frequency %></changefreq>
|
37
|
+
<% end %>
|
26
38
|
</url>
|
27
39
|
<% end %>
|
28
40
|
|
@@ -31,6 +43,12 @@
|
|
31
43
|
<url>
|
32
44
|
<loc><%= xml_escape absolute_url(file.relative_path) %></loc>
|
33
45
|
<lastmod><%= file.modified_time.localtime.xmlschema %></lastmod>
|
46
|
+
<% if file.data.sitemap_priority %>
|
47
|
+
<priority><%= file.data.sitemap_priority %></priority>
|
48
|
+
<% end %>
|
49
|
+
<% if file.data.sitemap_change_frequency %>
|
50
|
+
<changefreq><%= file.data.sitemap_change_frequency %></changefreq>
|
51
|
+
<% end %>
|
34
52
|
</url>
|
35
53
|
<% end %>
|
36
54
|
</urlset>
|
data/test/test_sitemap.rb
CHANGED
@@ -116,7 +116,7 @@ class TestSitemap < BridgetownSitemap::Test
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it "includes the correct number of items for the sitemap" do
|
119
|
-
assert_equal
|
119
|
+
assert_equal 19, @sitemap.scan(%r!(?=<url>)!).count
|
120
120
|
end
|
121
121
|
|
122
122
|
it "includes generated pages in the sitemap" do
|
@@ -126,6 +126,11 @@ class TestSitemap < BridgetownSitemap::Test
|
|
126
126
|
it "renders liquid in the robots.txt" do
|
127
127
|
assert_match "Sitemap: https://example.com/sitemap.xml", @robots
|
128
128
|
end
|
129
|
+
|
130
|
+
it "renders the priority and changefreq properties if needed" do
|
131
|
+
assert_match %r!<priority>0.8</priority>!, @sitemap
|
132
|
+
assert_match %r!<changefreq>monthly</changefreq>!, @sitemap
|
133
|
+
end
|
129
134
|
end
|
130
135
|
|
131
136
|
describe "rendering the site with a base URL" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ayush Newatia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- test/fixtures/src/some-subfolder/htm.htm
|
124
124
|
- test/fixtures/src/some-subfolder/index.html
|
125
125
|
- test/fixtures/src/some-subfolder/test_index.html
|
126
|
+
- test/fixtures/src/some-subfolder/test_priority_and_changefreq.html
|
126
127
|
- test/fixtures/src/some-subfolder/this-is-a-subfile.html
|
127
128
|
- test/fixtures/src/some-subfolder/this-is-a-subpage.html
|
128
129
|
- test/fixtures/src/some-subfolder/xhtml.xhtml
|
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
- !ruby/object:Gem::Version
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
+
rubygems_version: 3.4.10
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: Automatically generate a sitemap.xml for your Bridgetown site.
|
@@ -179,6 +180,7 @@ test_files:
|
|
179
180
|
- test/fixtures/src/some-subfolder/htm.htm
|
180
181
|
- test/fixtures/src/some-subfolder/index.html
|
181
182
|
- test/fixtures/src/some-subfolder/test_index.html
|
183
|
+
- test/fixtures/src/some-subfolder/test_priority_and_changefreq.html
|
182
184
|
- test/fixtures/src/some-subfolder/this-is-a-subfile.html
|
183
185
|
- test/fixtures/src/some-subfolder/this-is-a-subpage.html
|
184
186
|
- test/fixtures/src/some-subfolder/xhtml.xhtml
|