jekyll-shorts 0.0.7 → 0.0.9
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 +4 -4
- data/Gemfile +1 -1
- data/jekyll-shorts.gemspec +1 -1
- data/lib/jekyll-shorts/generator.rb +23 -4
- data/lib/jekyll-shorts/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19dbd54e213bdc8e27904bc45c7d90329249a7f6c08d30a48da152bc4919f242
|
4
|
+
data.tar.gz: b860aaeb8736d59a5d9fcc788ac9a9f107987b2aa674ba143f249a24ac21a69a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d931a1f5b061a28c2727c0c2bf8599088bc50ebb5ae40bd929ae40358a23656379257ce557b0bb92b621088343a48e182255ad00f0ee1651452377abb726272
|
7
|
+
data.tar.gz: 71dd2096e0bcb918b19b4e69d9fc6052ae5aacf014eed22cc035d0a854d60e35ead85ccf4e122b6db5d74a45c75cdf566dcc7ed97ad878690efac861980ec112
|
data/Gemfile
CHANGED
@@ -28,6 +28,6 @@ gemspec
|
|
28
28
|
gem 'cucumber', '9.1.0', require: false
|
29
29
|
gem 'minitest', '5.22.1', require: false
|
30
30
|
gem 'rake', '13.1.0', require: false
|
31
|
-
gem 'rubocop', '1.
|
31
|
+
gem 'rubocop', '1.60.2', require: false
|
32
32
|
gem 'rubocop-rspec', '2.26.1', require: false
|
33
33
|
gem 'simplecov', '0.22.0', require: false
|
data/jekyll-shorts.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
29
|
s.required_ruby_version = '>= 2.6'
|
30
30
|
s.name = 'jekyll-shorts'
|
31
|
-
s.version = '0.0.
|
31
|
+
s.version = '0.0.9'
|
32
32
|
s.license = 'MIT'
|
33
33
|
s.summary = 'Automatically generates short links for Jekyll website'
|
34
34
|
s.description = [
|
@@ -77,11 +77,30 @@ class JekyllShorts::Generator < Jekyll::Generator
|
|
77
77
|
@long = long
|
78
78
|
end
|
79
79
|
|
80
|
+
def modified?
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
def modified_time
|
85
|
+
Time.now
|
86
|
+
end
|
87
|
+
|
80
88
|
def write(_dest)
|
81
89
|
FileUtils.mkdir_p(File.dirname(path))
|
82
|
-
|
83
|
-
|
84
|
-
|
90
|
+
re = "#{@site.config['url']}#{@long}"
|
91
|
+
html = [
|
92
|
+
'<!DOCTYPE html>',
|
93
|
+
'<html lang="en-US">',
|
94
|
+
'<meta charset="utf-8">',
|
95
|
+
'<title>Redirecting…</title>',
|
96
|
+
"<link rel='canonical' href='#{re}'>",
|
97
|
+
"<script>location='#{re}'</script>",
|
98
|
+
"<meta http-equiv='refresh' content='0; url=#{re}'>",
|
99
|
+
'<meta name="robots" content="noindex">',
|
100
|
+
'<h1>Redirecting…</h1>',
|
101
|
+
"<a href='#{re}'>Click here if you are not redirected.</a>",
|
102
|
+
'</html>'
|
103
|
+
].join
|
85
104
|
if File.exist?(path)
|
86
105
|
before = File.read(path)
|
87
106
|
if before != html
|
@@ -93,7 +112,7 @@ than before. Try to run 'jekyll clean', it will help, if you know what you are d
|
|
93
112
|
end
|
94
113
|
else
|
95
114
|
File.write(path, html)
|
96
|
-
Jekyll.logger.debug("
|
115
|
+
Jekyll.logger.debug("Short URL created from #{path.inspect} to #{@long.inspect}")
|
97
116
|
end
|
98
117
|
true
|
99
118
|
end
|