jekyll-make-sitemap 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +8 -7
- data/lib/jekyll/make/sitemap.rb +14 -12
- data/lib/jekyll/make/sitemap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747e9d3bd9adc8a0d7db1fd6379ba8aab2203e0465462ba9d2a4e538099411c9
|
4
|
+
data.tar.gz: a2eef6977c29825ef55f3b146b67fcb2d6fc13860403bff219e68c8b2bbee047
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ddf73ff828897b22b0ce5cb735bda203db2b4ed65a7638d42add685d539c38e0ef53c2ca19200759a4177d5ffbf065defb755832587a888fc0add123cb4395
|
7
|
+
data.tar.gz: 297a2b48a34c56831f5e76bf0a239247e1239d6e8e40130b7f35786dfa791ee5ce296160e63e62bf94b74b8e49c5f885e91cac5ae73b062f162db7b8632287c7
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
-
## [1.
|
7
|
+
## [1.1.0] - 2020-07-12
|
8
|
+
|
9
|
+
Added
|
10
|
+
- Ability to run on non-production environments
|
11
|
+
|
12
|
+
Fixed
|
13
|
+
- Compatibility with `jekyll serve`
|
14
|
+
|
15
|
+
## [1.0.0] - 2020-07-11
|
8
16
|
|
9
17
|
Uploaded initial version
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# [jekyll-make-sitemap](https://rubygems.org/gems/jekyll-make-sitemap)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/jekyll-make-sitemap.svg)](https://badge.fury.io/rb/jekyll-make-sitemap)
|
3
3
|
|
4
|
-
|
4
|
+
jekyll-make-sitemap is a Jekyll hook plugin for generating a `sitemap.txt` file during the Jekyll build process. If you're interested in generating an XML sitemap I recommend checking out [jekyll-sitemap](https://github.com/jekyll/jekyll-sitemap).
|
5
|
+
|
6
|
+
This plugin includes all pages and posts by default. See the [Configuration](#Configuration) section for more on configuring your sitemap.
|
5
7
|
|
6
8
|
## Installation
|
7
9
|
```
|
@@ -21,18 +23,17 @@ end
|
|
21
23
|
## Configuration
|
22
24
|
In `_config.yml`
|
23
25
|
``` yaml
|
24
|
-
...
|
25
|
-
plugins:
|
26
|
-
- jekyll-make-sitemap
|
27
|
-
...
|
28
26
|
jekyll-make-sitemap:
|
29
27
|
pages: true # Default: true
|
30
28
|
posts: true # Default: true
|
31
|
-
|
29
|
+
environments: # Default: ['production']
|
30
|
+
- production
|
31
|
+
- development
|
32
|
+
collections: # Default: []
|
32
33
|
- collection_1 # include items from collection_1 in sitemap
|
33
34
|
```
|
34
35
|
|
35
|
-
|
36
|
+
### Exceptions
|
36
37
|
To exclude a page or post, assign it the `sitemap-exclude` tag
|
37
38
|
|
38
39
|
## License
|
data/lib/jekyll/make/sitemap.rb
CHANGED
@@ -5,14 +5,12 @@ module Jekyll
|
|
5
5
|
class Sitemap
|
6
6
|
class Error < StandardError; end
|
7
7
|
class << self
|
8
|
-
def generate(site, payload)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
config = site.config.has_key?("jekyll-make-sitemap") ? site.config["jekyll-make-sitemap"] : default_config
|
8
|
+
def generate(site, payload, file)
|
9
|
+
default_config = { 'pages' => true, 'posts' => true, 'environments' => ['production'] }
|
10
|
+
config = site.config.has_key?("jekyll-make-sitemap") ? site.config["jekyll-make-sitemap"] : default_config
|
11
|
+
if config['environments'].include?(payload.jekyll.environment)
|
13
12
|
baseurl = site.config["url"]
|
14
13
|
collections = config.has_key?("collections") ? ["collections"] : []
|
15
|
-
|
16
14
|
unless config.has_key?("pages") && config["pages"] == false
|
17
15
|
payload.site.pages.each do |page| process(file, page, baseurl) end
|
18
16
|
end
|
@@ -22,8 +20,6 @@ module Jekyll
|
|
22
20
|
collections.each do |col|
|
23
21
|
site.collections[col].docs.each do |post| process(file, post, baseurl) end
|
24
22
|
end
|
25
|
-
|
26
|
-
file.close()
|
27
23
|
end
|
28
24
|
end
|
29
25
|
def process(file, doc, baseurl)
|
@@ -36,10 +32,16 @@ module Jekyll
|
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
39
|
-
Jekyll::Hooks.register :site, :
|
40
|
-
File.new("sitemap.txt", "w")
|
35
|
+
Jekyll::Hooks.register :site, :after_reset do |site|
|
36
|
+
File.new("sitemap.txt", "w") if !File.exist?("sitemap.txt")
|
37
|
+
end
|
38
|
+
|
39
|
+
Jekyll::Hooks.register :site, :post_render do |site, payload|
|
40
|
+
file = File.open("sitemap.txt", "w+")
|
41
|
+
Jekyll::Make::Sitemap.generate(site, payload, file)
|
42
|
+
file.close
|
41
43
|
end
|
42
44
|
|
43
|
-
Jekyll::Hooks.register :site, :
|
44
|
-
|
45
|
+
Jekyll::Hooks.register :site, :post_write do |site|
|
46
|
+
File.delete("sitemap.txt")
|
45
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-make-sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Hofer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Jekyll hook for generating a sitemap.txt in production builds
|
14
14
|
email:
|