middleman-search_engine_sitemap 1.0.0.rc → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -8
- data/lib/middleman/search_engine_sitemap/templates/sitemap.xml.builder +2 -2
- data/lib/middleman/search_engine_sitemap/version.rb +1 -1
- data/lib/middleman/search_engine_sitemap.rb +1 -1
- data/spec/features/sitemap_feature_spec.rb +29 -1
- data/spec/support/middleman_server_helpers.rb +1 -1
- metadata +3 -5
- data/lib/middleman-search_engine_sitemap.rb +0 -2
- data/lib/middleman_extension.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a708a284c7a60e8ddd971f9f7c9e3753f3b347ac
|
4
|
+
data.tar.gz: cf8301d6a3c9f1466428affc4be879b3f859e466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e32be778fb3ea11b6eae752c6dca5ec4f23652d797c4b1ba630cd81138d3a87bd539de094e8e1cd17a9919ee0ff2ba9ac1410a13a05d00db591d8063d4b95f
|
7
|
+
data.tar.gz: 3818a199d1856ed6e6efc3582f815231a88328be24aac6c67723a967f454d7e5ab4a9da8bbcf612291b21110e0aa974b682e763af6e5ac6e65b895a1caab5932
|
data/README.md
CHANGED
@@ -1,12 +1,29 @@
|
|
1
1
|
# Middleman Search Engine Sitemap
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/Aupajo/middleman-search_engine_sitemap.png?branch=master)](https://travis-ci.org/Aupajo/middleman-search_engine_sitemap)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/Aupajo/middleman-search_engine_sitemap.png)](https://codeclimate.com/github/Aupajo/middleman-search_engine_sitemap)
|
4
5
|
|
5
|
-
|
6
|
+
[Sitemaps](http://www.sitemaps.org/) are an open standard to tell search engines (such as Google) about each page on your site, how often they're updated, and how important each page is, relative to other pages on your site.
|
7
|
+
|
8
|
+
This project aims to simplify including the sitemap XML file along with your Middleman site, so that you can better instruct search engines on how to index your pages.
|
9
|
+
|
10
|
+
For more information on the standard itself, please visit http://www.sitemaps.org/.
|
6
11
|
|
7
12
|
## Installation
|
8
13
|
|
9
|
-
|
14
|
+
Add this line to your Middleman site's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'middleman-search_engine_sitemap'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install middleman-search_engine_sitemap
|
10
27
|
|
11
28
|
## Usage
|
12
29
|
|
@@ -18,17 +35,16 @@ set :url_root, 'http://example.com'
|
|
18
35
|
activate :search_engine_sitemap
|
19
36
|
```
|
20
37
|
|
21
|
-
Pages have a priority of 0.5 and a change frequency of
|
38
|
+
Pages have a priority of 0.5 and a change frequency of `monthly` by default.
|
22
39
|
|
23
|
-
You can change
|
40
|
+
You can change these values by passing in options to the `activate` directive:
|
24
41
|
|
25
42
|
```ruby
|
26
43
|
activate :search_engine_sitemap, default_priority: 0.5,
|
27
|
-
default_change_frequency: "monthly"
|
28
|
-
sitemap_xml_path: "sitemap.xml"
|
44
|
+
default_change_frequency: "monthly"
|
29
45
|
```
|
30
46
|
|
31
|
-
You can override the priority or change frequency on
|
47
|
+
You can override the priority or change frequency on particular pages by using frontmatter:
|
32
48
|
|
33
49
|
```erb
|
34
50
|
---
|
@@ -40,7 +56,11 @@ change_frequency: daily
|
|
40
56
|
Welcome to my blog!
|
41
57
|
```
|
42
58
|
|
43
|
-
###
|
59
|
+
### Priority
|
60
|
+
|
61
|
+
A number between 0.0 and 1.0, representing how important the page is, relevant to other pages on your site.
|
62
|
+
|
63
|
+
The default value is 0.5.
|
44
64
|
|
45
65
|
From [sitemaps.org](http://www.sitemaps.org/protocol.html):
|
46
66
|
|
@@ -50,6 +70,12 @@ From [sitemaps.org](http://www.sitemaps.org/protocol.html):
|
|
50
70
|
|
51
71
|
> Also, please note that assigning a high priority to all of the URLs on your site is not likely to help you. Since the priority is relative, it is only used to select between URLs on your site.
|
52
72
|
|
73
|
+
### Change Frequency
|
74
|
+
|
75
|
+
Possible values are: `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `never`.
|
76
|
+
|
77
|
+
The default value is `monthly`.
|
78
|
+
|
53
79
|
## Contributing
|
54
80
|
|
55
81
|
1. Fork it ( http://github.com/<my-github-username>/middleman-search_engine_sitemap/fork )
|
@@ -1,8 +1,8 @@
|
|
1
1
|
xml.instruct!
|
2
2
|
xml.urlset 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
|
3
|
-
sitemap.resources.select { |page| page.path
|
3
|
+
sitemap.resources.select { |page| page.path.end_with?('.html') }.each do |page|
|
4
4
|
xml.url do
|
5
|
-
xml.loc File.join(url_root, page.
|
5
|
+
xml.loc File.join(url_root, page.url)
|
6
6
|
xml.lastmod File.mtime(page.source_file).iso8601
|
7
7
|
xml.changefreq page.data.change_frequency || default_change_frequency
|
8
8
|
xml.priority page.data.priority || default_priority
|
@@ -11,7 +11,7 @@ module Middleman
|
|
11
11
|
option :default_change_frequency, 'monthly', 'Default page priority for search engine sitemap'
|
12
12
|
option :sitemap_xml_path, 'sitemap.xml', 'Path to search engine sitemap'
|
13
13
|
|
14
|
-
def
|
14
|
+
def after_configuration
|
15
15
|
register_extension_templates
|
16
16
|
end
|
17
17
|
|
@@ -7,7 +7,6 @@ describe "Search engine sitemaps", :feature do
|
|
7
7
|
it "produces a sitemap" do
|
8
8
|
run_site 'dummy' do
|
9
9
|
set :url_root, 'http://example.com'
|
10
|
-
|
11
10
|
activate :search_engine_sitemap
|
12
11
|
end
|
13
12
|
|
@@ -35,4 +34,33 @@ describe "Search engine sitemaps", :feature do
|
|
35
34
|
'changefreq' => 'daily'
|
36
35
|
)
|
37
36
|
end
|
37
|
+
|
38
|
+
it "works with directory indexes" do
|
39
|
+
run_site 'dummy' do
|
40
|
+
set :url_root, 'http://example.com'
|
41
|
+
activate :directory_indexes
|
42
|
+
activate :search_engine_sitemap
|
43
|
+
end
|
44
|
+
|
45
|
+
visit '/sitemap.xml'
|
46
|
+
doc = Nokogiri::XML(last_response.body)
|
47
|
+
|
48
|
+
expect(doc).to contain_node('url').with_children(
|
49
|
+
'loc' => 'http://example.com/home/',
|
50
|
+
'priority' => '0.5',
|
51
|
+
'changefreq' => 'monthly'
|
52
|
+
)
|
53
|
+
|
54
|
+
expect(doc).to contain_node('url').with_children(
|
55
|
+
'loc' => 'http://example.com/about/',
|
56
|
+
'priority' => '0.2',
|
57
|
+
'changefreq' => 'monthly'
|
58
|
+
)
|
59
|
+
|
60
|
+
expect(doc).to contain_node('url').with_children(
|
61
|
+
'loc' => 'http://example.com/blog/',
|
62
|
+
'priority' => '0.5',
|
63
|
+
'changefreq' => 'daily'
|
64
|
+
)
|
65
|
+
end
|
38
66
|
end
|
@@ -24,7 +24,7 @@ module MiddlemanServerHelpers
|
|
24
24
|
instance = Middleman::Application.server.inst do
|
25
25
|
# Require the pagination extension after the
|
26
26
|
# server has booted, as would typically happen.
|
27
|
-
require File.expand_path('../../../lib/
|
27
|
+
require File.expand_path('../../../lib/middleman/search_engine_sitemap', __FILE__)
|
28
28
|
|
29
29
|
instance_exec(&block)
|
30
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-search_engine_sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Nicholls
|
@@ -108,11 +108,9 @@ files:
|
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
|
-
- lib/middleman-search_engine_sitemap.rb
|
112
111
|
- lib/middleman/search_engine_sitemap.rb
|
113
112
|
- lib/middleman/search_engine_sitemap/templates/sitemap.xml.builder
|
114
113
|
- lib/middleman/search_engine_sitemap/version.rb
|
115
|
-
- lib/middleman_extension.rb
|
116
114
|
- middleman-search_engine_sitemap.gemspec
|
117
115
|
- sitemap.xsd
|
118
116
|
- spec/dummy/source/about.html
|
@@ -138,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
136
|
version: '0'
|
139
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
138
|
requirements:
|
141
|
-
- - "
|
139
|
+
- - ">="
|
142
140
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
141
|
+
version: '0'
|
144
142
|
requirements: []
|
145
143
|
rubyforge_project:
|
146
144
|
rubygems_version: 2.2.1
|
data/lib/middleman_extension.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Auto-register extension for Middleman
|