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 +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -4
- data/jekyll-news-sitemap.gemspec +1 -1
- data/lib/jekyll-news-sitemap/version.rb +1 -1
- data/lib/sitemap_news.xml +19 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dc41940c56d8b2e5397407e990c26926f549a21ff20d42cb48a2f2919a3a505
|
4
|
+
data.tar.gz: 819e09c6e3e2d3c77f2a76f03489529e1b76d70192b6470b922891c69cba6212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
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
|
|
data/jekyll-news-sitemap.gemspec
CHANGED
@@ -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.
|
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")
|
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
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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.
|
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:
|
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
|