jekyll-make-sitemap 1.0.1 → 1.1.0

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: 8f040a8c5737b7efc45e9e8ab37a40d1543cc16f10394e6d6cc4c92721fbbf98
4
- data.tar.gz: 06d8e64bd564e9673d34143f564ff2735863fc17708e0a444006c4026baf6f03
3
+ metadata.gz: 747e9d3bd9adc8a0d7db1fd6379ba8aab2203e0465462ba9d2a4e538099411c9
4
+ data.tar.gz: a2eef6977c29825ef55f3b146b67fcb2d6fc13860403bff219e68c8b2bbee047
5
5
  SHA512:
6
- metadata.gz: 83962694d35aa068db6b71c13a5e383a0cedafea095f90e73635edb5878fbfc5f1670295c8adee9129eaaf28d884e6cb7385493042b9a9e8a148f995c86f06e4
7
- data.tar.gz: b7258225a86e8c0e5a1ca744b8bbc25e920955ff24e4a9ee092f5ed6db280b2c489196583ded522eeb506525374f342b97236b273931e27c6ab2ea0b898a80cd
6
+ metadata.gz: 68ddf73ff828897b22b0ce5cb735bda203db2b4ed65a7638d42add685d539c38e0ef53c2ca19200759a4177d5ffbf065defb755832587a888fc0add123cb4395
7
+ data.tar.gz: 297a2b48a34c56831f5e76bf0a239247e1239d6e8e40130b7f35786dfa791ee5ce296160e63e62bf94b74b8e49c5f885e91cac5ae73b062f162db7b8632287c7
@@ -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.0.0] - 2020-07-12
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
- Description
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
- collections:
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
- ## Exceptions
36
+ ### Exceptions
36
37
  To exclude a page or post, assign it the `sitemap-exclude` tag
37
38
 
38
39
  ## License
@@ -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
- if payload.jekyll.environment == "production"
10
- default_config = { 'pages' => true, 'posts' => true }
11
- file = File.open("sitemap.txt", "w+")
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, :after_init do |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, :pre_render do |site, payload|
44
- Jekyll::Make::Sitemap.generate(site, payload)
45
+ Jekyll::Hooks.register :site, :post_write do |site|
46
+ File.delete("sitemap.txt")
45
47
  end
@@ -1,7 +1,7 @@
1
1
  module Jekyll
2
2
  module Make
3
3
  class Sitemap
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
7
7
  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.1
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-12 00:00:00.000000000 Z
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: