jekyll-make-sitemap 1.0.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/Gemfile.lock +1 -1
- data/README.md +12 -3
- data/jekyll-make-sitemap.gemspec +5 -5
- data/lib/jekyll/make/sitemap.rb +57 -0
- data/lib/jekyll/make/sitemap/version.rb +7 -0
- metadata +8 -6
- data/lib/jekyll/make-sitemap.rb +0 -42
- data/lib/jekyll/make-sitemap/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 463bbed9ec6b232b18f6570ee9050a516847d2c9ffae1c2c85cf92e63b341ba8
|
4
|
+
data.tar.gz: 0ef72dc954b89249c113b1f5cd3c7419d2fcd2b873bb5e04623343f609ffb6ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf72ce53cb0ec9d5b7a1002e8cf0f59e41566bf8362fa69f1793991704e47532310fdc478bfdbc16b43c7fedb3212f4b4f5d8217bed4d3859f7426e041ccd45c
|
7
|
+
data.tar.gz: c7023a625232bfb50b2f96de78284e26748ba69abc33500f6fdf4dae75d4c264c74494942588d9143231b73158bd81a86a571909efc6b962f1b8461f0fa0265f
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,22 @@ 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.2.1] - 2020-07-19
|
8
|
+
|
9
|
+
Added
|
10
|
+
- Ability to include posts by category in configuration
|
11
|
+
|
12
|
+
Fixed
|
13
|
+
- Bug where default env config is lost if there are config settings but none for envs
|
14
|
+
|
15
|
+
## [1.1.1] - 2020-07-12
|
16
|
+
|
17
|
+
Added
|
18
|
+
- Ability to run on non-production environments
|
19
|
+
|
20
|
+
Fixed
|
21
|
+
- Compatibility with `jekyll serve`
|
22
|
+
|
23
|
+
## [1.0.0] - 2020-07-11
|
8
24
|
|
9
25
|
Uploaded initial version
|
data/Gemfile.lock
CHANGED
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
|
+
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
|
```
|
@@ -23,11 +25,18 @@ In `_config.yml`
|
|
23
25
|
``` yaml
|
24
26
|
jekyll-make-sitemap:
|
25
27
|
pages: true # Default: true
|
26
|
-
posts:
|
27
|
-
|
28
|
+
posts: # Default: true
|
29
|
+
- category # Categories of posts to include in sitemap; accepts true, false, or a list of categories
|
30
|
+
environments: # Default: ['production']
|
31
|
+
- production
|
32
|
+
- development
|
33
|
+
collections: # Default: []
|
28
34
|
- collection_1 # include items from collection_1 in sitemap
|
29
35
|
```
|
30
36
|
|
37
|
+
### Exceptions
|
38
|
+
To exclude a page or post, assign it the `sitemap-exclude` tag
|
39
|
+
|
31
40
|
## License
|
32
41
|
|
33
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/jekyll-make-sitemap.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require_relative 'lib/jekyll/make
|
1
|
+
require_relative 'lib/jekyll/make/sitemap/version'
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "jekyll-make-sitemap"
|
5
|
-
spec.version = Jekyll::
|
5
|
+
spec.version = Jekyll::Make::Sitemap::VERSION
|
6
6
|
spec.authors = ["Sean Hofer"]
|
7
7
|
spec.email = ["me@seanhofer.com"]
|
8
8
|
|
9
|
-
spec.summary = "A Jekyll hook for generating a sitemap.txt
|
10
|
-
spec.description = "A Jekyll hook for generating a sitemap.txt
|
9
|
+
spec.summary = "A Jekyll hook plugin for generating a sitemap.txt file during the Jekyll build process."
|
10
|
+
spec.description = "A Jekyll hook plugin for generating a sitemap.txt file during the Jekyll build process."
|
11
11
|
spec.homepage = "https://github.com/hofers/jekyll-make-sitemap"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
20
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/})
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) or f.match(/^jekyll-make-sitemap-\d\.\d\.\d\.gem$/) }
|
22
22
|
end
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'jekyll'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Make
|
5
|
+
class Sitemap
|
6
|
+
class Error < StandardError; end
|
7
|
+
class << self
|
8
|
+
def generate(site, payload, file)
|
9
|
+
default_config = { 'pages' => true, 'posts' => true, 'environments' => ['production'] }
|
10
|
+
config = site.config.has_key?("jekyll-make-sitemap") ? default_config.merge(site.config["jekyll-make-sitemap"]) : default_config
|
11
|
+
if config["environments"].include?(payload.jekyll.environment)
|
12
|
+
baseurl = site.config["url"]
|
13
|
+
collections = config.has_key?("collections") ? config["collections"] : []
|
14
|
+
unless config.has_key?("pages") && config["pages"] == false
|
15
|
+
payload.site.pages.each do |page| process(file, page, baseurl) end
|
16
|
+
end
|
17
|
+
unless config.has_key?("posts") && config["posts"] == false
|
18
|
+
payload.site.posts.each do |post|
|
19
|
+
if !config["posts"].eql?(true)
|
20
|
+
config["posts"].each do |cat|
|
21
|
+
if post.data.has_key?("categories") && post.data["categories"].include?(cat)
|
22
|
+
process(file, post, baseurl)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
process(file, post, baseurl)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
collections.each do |col|
|
31
|
+
site.collections[col].docs.each do |post| process(file, post, baseurl) end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
def process(file, doc, baseurl)
|
36
|
+
if !((doc.data.has_key?("tags") && doc.data["tags"].include?("sitemap-exclude")) || !doc.path.end_with?(".md"))
|
37
|
+
file.write "#{baseurl}#{doc.url}\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Jekyll::Hooks.register :site, :after_reset do |site|
|
46
|
+
File.new("sitemap.txt", "w") if !File.exist?("sitemap.txt")
|
47
|
+
end
|
48
|
+
|
49
|
+
Jekyll::Hooks.register :site, :post_render do |site, payload|
|
50
|
+
file = File.open("sitemap.txt", "w+")
|
51
|
+
Jekyll::Make::Sitemap.generate(site, payload, file)
|
52
|
+
file.close
|
53
|
+
end
|
54
|
+
|
55
|
+
Jekyll::Hooks.register :site, :post_write do |site|
|
56
|
+
File.delete("sitemap.txt")
|
57
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-make-sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: A Jekyll hook for generating a sitemap.txt
|
13
|
+
description: A Jekyll hook plugin for generating a sitemap.txt file during the Jekyll
|
14
|
+
build process.
|
14
15
|
email:
|
15
16
|
- me@seanhofer.com
|
16
17
|
executables: []
|
@@ -28,8 +29,8 @@ files:
|
|
28
29
|
- bin/console
|
29
30
|
- bin/setup
|
30
31
|
- jekyll-make-sitemap.gemspec
|
31
|
-
- lib/jekyll/make
|
32
|
-
- lib/jekyll/make
|
32
|
+
- lib/jekyll/make/sitemap.rb
|
33
|
+
- lib/jekyll/make/sitemap/version.rb
|
33
34
|
homepage: https://github.com/hofers/jekyll-make-sitemap
|
34
35
|
licenses:
|
35
36
|
- MIT
|
@@ -54,5 +55,6 @@ requirements: []
|
|
54
55
|
rubygems_version: 3.1.4
|
55
56
|
signing_key:
|
56
57
|
specification_version: 4
|
57
|
-
summary: A Jekyll hook for generating a sitemap.txt
|
58
|
+
summary: A Jekyll hook plugin for generating a sitemap.txt file during the Jekyll
|
59
|
+
build process.
|
58
60
|
test_files: []
|
data/lib/jekyll/make-sitemap.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require "jekyll"
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
class MakeSitemap
|
5
|
-
class << self
|
6
|
-
def generate(site, payload)
|
7
|
-
if payload.jekyll.environment == "production"
|
8
|
-
default_config = { 'pages' => true, 'posts' => true }
|
9
|
-
file = File.open("sitemap.txt", "w+")
|
10
|
-
config = site.config.has_key?("jekyll-make-sitemap") ? site.config["jekyll-make-sitemap"] : default_config
|
11
|
-
baseurl = site.config["url"]
|
12
|
-
collections = config.has_key?("collections") ? ["collections"] : []
|
13
|
-
|
14
|
-
unless config.has_key?("pages") && config["pages"] == false
|
15
|
-
payload.site.pages.each do |page| process(file, page, baseurl) end
|
16
|
-
end
|
17
|
-
unless config.has_key?("posts") && config["posts"] == false
|
18
|
-
payload.site.posts.each do |post| process(file, post, baseurl) end
|
19
|
-
end
|
20
|
-
collections.each do |col|
|
21
|
-
site.collections[col].docs.each do |post| process(file, post, baseurl) end
|
22
|
-
end
|
23
|
-
|
24
|
-
file.close()
|
25
|
-
end
|
26
|
-
end
|
27
|
-
def process(file, doc, baseurl)
|
28
|
-
if !((doc.data.has_key?("tags") && doc.data["tags"].include?("sitemap-exclude")) || !doc.path.end_with?(".md"))
|
29
|
-
file.write "#{baseurl}#{doc.url}\n"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
Jekyll::Hooks.register :site, :after_init do |site|
|
37
|
-
File.new("sitemap.txt", "w")
|
38
|
-
end
|
39
|
-
|
40
|
-
Jekyll::Hooks.register :site, :pre_render do |site, payload|
|
41
|
-
Jekyll::MakeSitemap.generate(site, payload)
|
42
|
-
end
|