jekyll-news-sitemap 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48a2bd80aec53a019ab28323fc742ea821f6e9b3382c0b261a520ba8daf07a04
4
- data.tar.gz: 5474bbaee04b27003c3383f56275ea3fe547fe6c5294ff91ad3db9153bdf58fd
3
+ metadata.gz: 8dc41940c56d8b2e5397407e990c26926f549a21ff20d42cb48a2f2919a3a505
4
+ data.tar.gz: 819e09c6e3e2d3c77f2a76f03489529e1b76d70192b6470b922891c69cba6212
5
5
  SHA512:
6
- metadata.gz: 2030bc695c1a55ae6cc44aea214622aab0dbda5fcf3faa2e6c30aee781266fc9497b4dbef1b740889866eb5736d6f6887497ba7ea6a1fa53c40f40509f8edb23
7
- data.tar.gz: '0894327b8310cf4f0563ed4a74110cb4408eb8c4e0b0b5fc47e48b5646b2b1bcef109c08c8ac55622ef7d63fc1e7a2238878d260d9b3870714f17c3e752b654f'
6
+ metadata.gz: 7fe5c835adb2ad9b07ecbec1309e53d857c30155d7c9b0d670109e1d69a828f516857706fa24ecba3ef04afbf55413ccaba5dbe3aefcb787d466a949cc0b01cb
7
+ data.tar.gz: ff3296b137c18442ac36bc36bfc9eff0080db062078b44624105d53aecd1d24b5c91488c12c4f0a302cbf96b77fec4dad8580889eb5f8937264f292a4e2d302d
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.1]
8
+ ### Change
9
+ - include only posts from last 2 days
10
+
11
+ ## [0.1.0] - 2019-10-30
12
+ ### Added
13
+ - first version released
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-news-sitemap (0.1.0)
4
+ jekyll-news-sitemap (0.1.1)
5
5
  jekyll (>= 3.7, < 5.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/skatkov/jekyll-news-sitemap.svg?branch=master)](https://travis-ci.org/skatkov/jekyll-news-sitemap)
2
+
1
3
  # Jekyll::NewsSitemap
2
4
 
3
5
  *Jekyll plugin to silently generate Google News Sitemap based on posts*
@@ -5,7 +7,7 @@
5
7
  More info on Google News Sitemap could be found here:
6
8
  https://support.google.com/news/publisher-center/answer/9606710?hl=en&ref_topic=9606468
7
9
 
8
- This gem is a rip-off from jekyll-sitemap.
10
+ This gem was heavily infuenced by jekyll-sitemap and is still "work-in-progress".
9
11
  ## Usage
10
12
 
11
13
  1. Add `gem 'jekyll-news-sitemap'` to your site's Gemfile and run `bundle`
@@ -23,7 +25,7 @@ plugins:
23
25
  If all gem plugins have the same `priority`, they will be executed in the
24
26
  order they are required, generally. Thus, if you have other plugins which
25
27
  generate content and store that content in `site.pages`, `site.posts`, or
26
- `site.collections`, be sure to require `jekyll-sitemap` either *after*
28
+ `site.collections`, be sure to require `jekyll-news-sitemap` either *after*
27
29
  those other gems if you *want* the sitemap to include the generated
28
30
  content, or *before* those other gems if you *don't want* the sitemap to
29
31
  include the generated content from the gems. (Programming is *hard*.)
@@ -33,9 +35,9 @@ templates that iterate through all pages (for example, to build a menu of
33
35
  all of the site's content).
34
36
 
35
37
  ## Note on Use with GitHub Pages Gem
36
- The GitHub Pages gem ignores all plugins included in the Gemfile. If you only include `jekyll-sitemap` in the Gemfile without also including it in the `_config.yml` *the plugin will not work*. This can be confusing because the official Jekyll docs state that plugins can be included in either the Gemfile or `_config.yml`.
38
+ The GitHub Pages gem ignores all plugins included in the Gemfile. If you only include `jekyll-news-sitemap` in the Gemfile without also including it in the `_config.yml` *the plugin will not work*. This can be confusing because the official Jekyll docs state that plugins can be included in either the Gemfile or `_config.yml`.
37
39
 
38
- When building a site that uses the GitHub Pages gem, follow the instructions above and ensure that `jekyll-sitemap` is listed in the `plugins` array in `_config.yml`.
40
+ When building a site that uses the GitHub Pages gem, follow the instructions above and ensure that `jekyll-news-sitemap` is listed in the `plugins` array in `_config.yml`.
39
41
 
40
42
  :warning: If you are using Jekyll < 3.5.0 use the `gems` key instead of `plugins`.
41
43
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.email = ["sk@skylup.com"]
8
8
 
9
9
  spec.summary = "Jekyll gem for Google News sitemap"
10
- spec.description = "Your friendly gem to produce Google News sitemap compatible xml file. https://support.google.com/news/publisher-center/answer/9607107?visit_id=637212842293134890-921468621&rd=1 "
10
+ spec.description = "Your friendly gem to produce Google News sitemap compatible xml file."
11
11
  spec.homepage = "https://www.github.com/skatkov/jekyll-news-sitemap"
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module NewsSitemap
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
data/lib/sitemap_news.xml CHANGED
@@ -3,19 +3,26 @@
3
3
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
4
4
  xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
5
5
 
6
+ {% assign timeframe = 172800 %}
7
+
6
8
  {% assign posts = site.posts | where_exp:'doc','doc.sitemap != false' %}
7
- {% for page in posts %}
8
- <url>
9
- <loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
9
+ {% for post in posts %}
10
+ {% assign post_in_seconds = post.date | date: "%s" | plus: 0 %}
11
+ {% assign recent_posts = "now" | date: "%s" | minus: timeframe %}
12
+
13
+ {% if post_in_seconds > recent_posts %}
14
+ <url>
15
+ <loc>{{ post.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
10
16
 
11
- <news:news>
12
- <news:publication>
13
- <news:name>{{site.publisher}}</news:name>
14
- <news:language>en</news:language>
15
- </news:publication>
16
- <news:publication_date>{{ page.date | date_to_xmlschema }}</news:publication_date>
17
- <news:title>{{ page.title }}</news:title>
18
- </news:news>
19
- </url>
17
+ <news:news>
18
+ <news:publication>
19
+ <news:name>{{site.publisher}}</news:name>
20
+ <news:language>en</news:language>
21
+ </news:publication>
22
+ <news:publication_date>{{ post.date | date_to_xmlschema }}</news:publication_date>
23
+ <news:title>{{ post.title }}</news:title>
24
+ </news:news>
25
+ </url>
26
+ {% endif %}
20
27
  {% endfor %}
21
28
  </urlset>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-news-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav Katkov
@@ -86,8 +86,7 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0.4'
89
- description: 'Your friendly gem to produce Google News sitemap compatible xml file.
90
- https://support.google.com/news/publisher-center/answer/9607107?visit_id=637212842293134890-921468621&rd=1 '
89
+ description: Your friendly gem to produce Google News sitemap compatible xml file.
91
90
  email:
92
91
  - sk@skylup.com
93
92
  executables: []
@@ -99,6 +98,7 @@ files:
99
98
  - ".rspec"
100
99
  - ".rubocop_todo.yml"
101
100
  - ".travis.yml"
101
+ - CHANGELOG.md
102
102
  - CODE_OF_CONDUCT.md
103
103
  - Gemfile
104
104
  - Gemfile.lock