jekyll-news-sitemap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 91a9a3946d3981039dde60565d8fb3e450ec8080c60ad6f492700f29c0827f55
4
+ data.tar.gz: a77c75f763fc5d20b264ac2e55df62b2b70483b7f4c963c2d71ba7f866a41e5d
5
+ SHA512:
6
+ metadata.gz: 99d7cd585132968e7183f018ad0096730d4c9d4840c08ac90586a237f24ef69f643606f77ce3a8489e71573287bcf43eec857b6b248a6c77f3da061009c11677
7
+ data.tar.gz: 14d25281f8982297dbfc518c701eec07fc9237b30c3947f7b646f1048fb471f56157626b38fe200b95d986d6182997b9041e0bbc977c7652c898999413eff684
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .bundle
2
+ *.gem
3
+ spec/dest
4
+ spec/fixtures/.jekyll-cache
5
+ vendor/bundle
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build jekyll-news-sitemap-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install jekyll-news-sitemap-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install jekyll-news-sitemap-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push jekyll-news-sitemap-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,14 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-12-06 11:55:46 +0100 using RuboCop version 0.61.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+
10
+ # Offense count: 17
11
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
12
+ # URISchemes: http, https
13
+ Metrics/LineLength:
14
+ Max: 154
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sk@skylup.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jekyll-news-sitemap.gemspec
4
+ gemspec
5
+
6
+
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-news-sitemap (0.0.1)
5
+ jekyll (>= 3.7, < 5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.0)
13
+ colorator (1.1.0)
14
+ concurrent-ruby (1.1.6)
15
+ diff-lcs (1.3)
16
+ em-websocket (0.5.1)
17
+ eventmachine (>= 0.12.9)
18
+ http_parser.rb (~> 0.6.0)
19
+ eventmachine (1.2.7)
20
+ ffi (1.12.2)
21
+ forwardable-extended (2.6.0)
22
+ http_parser.rb (0.6.0)
23
+ i18n (1.8.2)
24
+ concurrent-ruby (~> 1.0)
25
+ jaro_winkler (1.5.4)
26
+ jekyll (4.0.0)
27
+ addressable (~> 2.4)
28
+ colorator (~> 1.0)
29
+ em-websocket (~> 0.5)
30
+ i18n (>= 0.9.5, < 2)
31
+ jekyll-sass-converter (~> 2.0)
32
+ jekyll-watch (~> 2.0)
33
+ kramdown (~> 2.1)
34
+ kramdown-parser-gfm (~> 1.0)
35
+ liquid (~> 4.0)
36
+ mercenary (~> 0.3.3)
37
+ pathutil (~> 0.9)
38
+ rouge (~> 3.0)
39
+ safe_yaml (~> 1.0)
40
+ terminal-table (~> 1.8)
41
+ jekyll-sass-converter (2.1.0)
42
+ sassc (> 2.0.1, < 3.0)
43
+ jekyll-watch (2.2.1)
44
+ listen (~> 3.0)
45
+ kramdown (2.1.0)
46
+ kramdown-parser-gfm (1.1.0)
47
+ kramdown (~> 2.0)
48
+ liquid (4.0.3)
49
+ listen (3.2.1)
50
+ rb-fsevent (~> 0.10, >= 0.10.3)
51
+ rb-inotify (~> 0.9, >= 0.9.10)
52
+ mercenary (0.3.6)
53
+ parallel (1.19.1)
54
+ parser (2.7.0.5)
55
+ ast (~> 2.4.0)
56
+ pathutil (0.16.2)
57
+ forwardable-extended (~> 2.6)
58
+ public_suffix (4.0.3)
59
+ rainbow (3.0.0)
60
+ rake (13.0.1)
61
+ rb-fsevent (0.10.3)
62
+ rb-inotify (0.10.1)
63
+ ffi (~> 1.0)
64
+ rexml (3.2.4)
65
+ rouge (3.17.0)
66
+ rspec (3.9.0)
67
+ rspec-core (~> 3.9.0)
68
+ rspec-expectations (~> 3.9.0)
69
+ rspec-mocks (~> 3.9.0)
70
+ rspec-core (3.9.1)
71
+ rspec-support (~> 3.9.1)
72
+ rspec-expectations (3.9.1)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.9.0)
75
+ rspec-mocks (3.9.1)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.9.0)
78
+ rspec-support (3.9.2)
79
+ rubocop (0.80.1)
80
+ jaro_winkler (~> 1.5.1)
81
+ parallel (~> 1.10)
82
+ parser (>= 2.7.0.1)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ rexml
85
+ ruby-progressbar (~> 1.7)
86
+ unicode-display_width (>= 1.4.0, < 1.7)
87
+ rubocop-jekyll (0.11.0)
88
+ rubocop (>= 0.68.0, < 0.81.0)
89
+ rubocop-performance (~> 1.2)
90
+ rubocop-performance (1.5.2)
91
+ rubocop (>= 0.71.0)
92
+ ruby-progressbar (1.10.1)
93
+ safe_yaml (1.0.5)
94
+ sassc (2.2.1)
95
+ ffi (~> 1.9)
96
+ terminal-table (1.8.0)
97
+ unicode-display_width (~> 1.1, >= 1.1.1)
98
+ unicode-display_width (1.6.1)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ bundler
105
+ jekyll-news-sitemap!
106
+ rake
107
+ rspec (~> 3.0)
108
+ rubocop-jekyll (~> 0.4)
109
+
110
+ BUNDLED WITH
111
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Stanislav Katkov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Jekyll::NewsSitemap
2
+
3
+ *Jekyll plugin to silently generate Google News Sitemap based on posts*
4
+
5
+ More info on Google News Sitemap could be found here:
6
+ https://support.google.com/news/publisher-center/answer/9606710?hl=en&ref_topic=9606468
7
+
8
+ This gem is a rip-off from jekyll-sitemap.
9
+ ## Usage
10
+
11
+ 1. Add `gem 'jekyll-news-sitemap'` to your site's Gemfile and run `bundle`
12
+ 2. Add the following to your site's `_config.yml`:
13
+
14
+ ```yml
15
+ url: "https://example.com" # the base hostname & protocol for your site
16
+ publisher: "The Example Times"
17
+ plugins:
18
+ - jekyll-news-sitemap
19
+ ```
20
+
21
+ 💡 If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.
22
+
23
+ If all gem plugins have the same `priority`, they will be executed in the
24
+ order they are required, generally. Thus, if you have other plugins which
25
+ generate content and store that content in `site.pages`, `site.posts`, or
26
+ `site.collections`, be sure to require `jekyll-sitemap` either *after*
27
+ those other gems if you *want* the sitemap to include the generated
28
+ content, or *before* those other gems if you *don't want* the sitemap to
29
+ include the generated content from the gems. (Programming is *hard*.)
30
+
31
+ Because the sitemap is added to `site.pages`, you may have to modify any
32
+ templates that iterate through all pages (for example, to build a menu of
33
+ all of the site's content).
34
+
35
+ ## 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`.
37
+
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`.
39
+
40
+ :warning: If you are using Jekyll < 3.5.0 use the `gems` key instead of `plugins`.
41
+
42
+
43
+ ## Exclusions
44
+
45
+ If you would like to exclude specific pages/posts from the sitemap set the
46
+ sitemap flag to `false` in the front matter for the page/post.
47
+
48
+ ```yml
49
+ sitemap: false
50
+ ```
51
+
52
+ To exclude files from your sitemap. It can be achieved with configuration using [Jekyll v3.7.2 and jekyll-sitemap v1.2.0](https://github.com/jekyll/jekyll/commit/776433109b96cb644938ffbf9caf4923bdde4d7f).
53
+
54
+ Add a glob config to your `_config.yml` file.
55
+
56
+ ```yml
57
+ defaults:
58
+ -
59
+ scope:
60
+ path: "assets/**/*.pdf"
61
+ values:
62
+ sitemap: false
63
+ ```
64
+
65
+ ## Override default development settings
66
+
67
+ [Follow these instructions on Jekyll's documentation](https://jekyllrb.com/docs/usage/#override-default-development-settings).
68
+
69
+ ## Developing locally
70
+
71
+ * Use `script/bootstrap` to bootstrap your local development environment.
72
+ * Use `script/console` to load a local IRB console with the Gem.
73
+
74
+ ## Testing
75
+
76
+ 1. `script/bootstrap`
77
+ 2. `script/cibuild`
78
+
79
+
80
+ ## Contributing
81
+
82
+ 1. Fork the project
83
+ 2. Create a descriptively named feature branch
84
+ 3. Add your feature
85
+ 4. Submit a pull request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jekyll/news/sitemap"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ require_relative 'lib/jekyll-news-sitemap/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "jekyll-news-sitemap"
5
+ spec.version = Jekyll::NewsSitemap::VERSION
6
+ spec.authors = ["Stanislav Katkov"]
7
+ spec.email = ["sk@skylup.com"]
8
+
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 "
11
+ spec.homepage = "https://www.github.com/skatkov/jekyll-news-sitemap"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://www.github.com/skatkov/jekyll-news-sitemap"
17
+ spec.metadata["changelog_uri"] = "https://www.github.com/skatkov/jekyll-news-sitemap/CHANGELOG.md"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+
29
+ spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
30
+
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.4"
35
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/page_without_a_file"
4
+ require "jekyll/jekyll-news-sitemap"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module NewsSitemap
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+
5
+ module Jekyll
6
+ class JekyllNewsSitemap < Jekyll::Generator
7
+ safe true
8
+ priority :lowest
9
+
10
+ # Main plugin action, called by Jekyll-core
11
+ def generate(site)
12
+ @site = site
13
+ @site.pages << sitemap unless file_exists?("sitemap_news.xml")
14
+ end
15
+
16
+ private
17
+
18
+ INCLUDED_EXTENSIONS = %w(
19
+ .htm
20
+ .html
21
+ .xhtml
22
+ .pdf
23
+ .xml
24
+ ).freeze
25
+
26
+ # Matches all whitespace that follows
27
+ # 1. A '>' followed by a newline or
28
+ # 2. A '}' which closes a Liquid tag
29
+ # We will strip all of this whitespace to minify the template
30
+ MINIFY_REGEX = %r!(?<=>\n|})\s+!.freeze
31
+
32
+ # Array of all non-jekyll site files with an HTML extension
33
+ def static_files
34
+ @site.static_files.select { |file| INCLUDED_EXTENSIONS.include? file.extname }
35
+ end
36
+
37
+ # Path to sitemap_news.xml template file
38
+ def source_path(file = "sitemap_news.xml")
39
+ File.expand_path "../#{file}", __dir__
40
+ end
41
+
42
+ # Destination for sitemap_news.xml file within the site source directory
43
+ def destination_path(file = "sitemap_news.xml")
44
+ @site.in_dest_dir(file)
45
+ end
46
+
47
+ def sitemap
48
+ site_map = PageWithoutAFile.new(@site, __dir__, "", "sitemap_news.xml")
49
+ site_map.content = File.read(source_path).gsub(MINIFY_REGEX, "")
50
+ site_map.data["layout"] = nil
51
+ site_map.data["static_files"] = static_files.map(&:to_liquid)
52
+ site_map.data["xsl"] = file_exists?("sitemap.xsl")
53
+ site_map
54
+ end
55
+
56
+ # Checks if a file already exists in the site source
57
+ def file_exists?(file_path)
58
+ pages_and_files.any? { |p| p.url == "/#{file_path}" }
59
+ end
60
+
61
+ def pages_and_files
62
+ @pages_and_files ||= @site.pages + @site.static_files
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class PageWithoutAFile < Page
5
+ # rubocop:disable Naming/MemoizedInstanceVariableName
6
+ def read_yaml(*)
7
+ @data ||= {}
8
+ end
9
+ # rubocop:enable Naming/MemoizedInstanceVariableName
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
4
+ xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
5
+
6
+ {% assign collections = site.collections | where_exp:'collection','collection.output != false' %}
7
+
8
+ {% for collection in collections %}
9
+ {% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %}
10
+ {% for doc in docs %}
11
+ <url>
12
+ <loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
13
+
14
+ <news:news>
15
+ <news:publication>
16
+ <news:name>{{page.publisher}}</news:name>
17
+ <news:language>en</news:language>
18
+ </news:publication>
19
+ <news:publication_date>{{ page.date | date_to_xmlschema }}</news:publication_date>
20
+ <news:title>{{ page.title }}</news:title>
21
+ </news:news>
22
+ </url>
23
+ {% endfor %}
24
+ {% endfor %}
25
+
26
+ {% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"'
27
+ %}
28
+ {% for page in pages %}
29
+ <url>
30
+ <loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
31
+
32
+ <news:news>
33
+ <news:publication>
34
+ <news:name>{{page.publisher}}</news:name>
35
+ <news:language>en</news:language>
36
+ </news:publication>
37
+ <news:publication_date>{{ page.date | date_to_xmlschema }}</news:publication_date>
38
+ <news:title>{{ page.title }}</news:title>
39
+ </news:news>
40
+ </url>
41
+ {% endfor %}
42
+ </urlset>
data/rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require: rubocop-jekyll
4
+ inherit_gem:
5
+ rubocop-jekyll: .rubocop.yml
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - vendor/**/*
data/script/bootstrap ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ set -ex
3
+
4
+ bundle install
data/script/cibuild ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ time script/fmt
5
+ time script/test
data/script/console ADDED
@@ -0,0 +1,35 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ def relative_to_root(path)
5
+ File.expand_path(path, File.dirname(__dir__))
6
+ end
7
+
8
+ require "jekyll"
9
+ require relative_to_root("lib/jekyll-news-sitemap.rb")
10
+ require "pry-debugger"
11
+
12
+ SOURCE_DIR = relative_to_root("spec/fixtures")
13
+ DEST_DIR = relative_to_root("spec/dest")
14
+
15
+ def source_dir(*files)
16
+ File.join(SOURCE_DIR, *files)
17
+ end
18
+
19
+ def dest_dir(*files)
20
+ File.join(DEST_DIR, *files)
21
+ end
22
+
23
+ def config(overrides = {})
24
+ Jekyll.configuration(
25
+ "source" => source_dir,
26
+ "destination" => dest_dir,
27
+ "url" => "http://example.org"
28
+ ).merge(overrides)
29
+ end
30
+
31
+ def site(configuration = config)
32
+ Jekyll::Site.new(configuration)
33
+ end
34
+
35
+ binding.pry
data/script/fmt ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Rubocop $(bundle exec rubocop --version)"
5
+ bundle exec rubocop -D -E $@
6
+ success=$?
7
+ if ((success != 0)); then
8
+ echo -e "\nTry running \`script/fmt -a\` to automatically fix errors"
9
+ fi
10
+ exit $success
data/script/release ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ script/cibuild
7
+ bundle exec rake release
data/script/test ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -ex
3
+
4
+ bundle exec rspec "$@"
5
+ bundle exec rspec spec/test_jekyll-last-modified-at.rb
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-news-sitemap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stanislav Katkov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-jekyll
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.4'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
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 '
91
+ email:
92
+ - sk@skylup.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - ".gitignore"
98
+ - ".rakeTasks"
99
+ - ".rspec"
100
+ - ".rubocop_todo.yml"
101
+ - ".travis.yml"
102
+ - CODE_OF_CONDUCT.md
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.md
107
+ - Rakefile
108
+ - bin/console
109
+ - bin/setup
110
+ - jekyll-news-sitemap.gemspec
111
+ - lib/jekyll-news-sitemap.rb
112
+ - lib/jekyll-news-sitemap/version.rb
113
+ - lib/jekyll/jekyll-news-sitemap.rb
114
+ - lib/jekyll/page_without_a_file.rb
115
+ - lib/sitemap_news.xml
116
+ - rubocop.yml
117
+ - script/bootstrap
118
+ - script/cibuild
119
+ - script/console
120
+ - script/fmt
121
+ - script/release
122
+ - script/test
123
+ homepage: https://www.github.com/skatkov/jekyll-news-sitemap
124
+ licenses:
125
+ - MIT
126
+ metadata:
127
+ homepage_uri: https://www.github.com/skatkov/jekyll-news-sitemap
128
+ source_code_uri: https://www.github.com/skatkov/jekyll-news-sitemap
129
+ changelog_uri: https://www.github.com/skatkov/jekyll-news-sitemap/CHANGELOG.md
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.3.0
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubygems_version: 3.0.8
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Jekyll gem for Google News sitemap
149
+ test_files: []