jekyll-autonofollow 0.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 +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jekyll-autonofollow.gemspec +32 -0
- data/lib/jekyll/autonofollow.rb +27 -0
- data/lib/jekyll/autonofollow/version.rb +5 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec2847bee9ed012fe59b0c9106aa1ec1c1dba816
|
4
|
+
data.tar.gz: e481fd06d51b7cc7ad109dccce1f12373784afa2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0131ed185e9486d97ef2e50179869679147c65a4bee4ae69e8cf70156685308c13f908212e665e649be48e4ffd0d481c59cfba58e4db10e6878de60d963deb99
|
7
|
+
data.tar.gz: a246b67b61196c4b219aafa5c5839e4bf18d5c05c6be0d8ff39c9f309db75cac8655d70178f81439bb80bdaf0e391ccfad498ddcc1d01ba47d694e46a7c5780e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 mrnerd
|
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,40 @@
|
|
1
|
+
jekyll-autonofollow
|
2
|
+
=========
|
3
|
+
|
4
|
+
jekyll-autonofollow is a Jekyll plugin that adds rel="nofollow" to all external urls in your posts.
|
5
|
+
|
6
|
+
The plugin adds rel="external nofollow" to all external links, make your website SEO friendly.
|
7
|
+
|
8
|
+
The plugin adds target="_blank", which opens external links in new window or tab
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
gem install jekyll-autonofollow
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
Enable and configure your plugin in _config.yml by adding the following
|
17
|
+
|
18
|
+
<pre>
|
19
|
+
nofollow:
|
20
|
+
enable: true
|
21
|
+
exclude:
|
22
|
+
- site1.com
|
23
|
+
- site2.com
|
24
|
+
</pre>
|
25
|
+
|
26
|
+
First you specify enable : true to enable the plugin .
|
27
|
+
|
28
|
+
Then you can optionally add a set of urls to exclude which means the plugin won't add rel="nofollow" when it encouters any link pointing to the excluded urls.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
You are more than welcome to contribute.
|
33
|
+
|
34
|
+
Simply fork the repo and send a pull request.
|
35
|
+
|
36
|
+
## Release History
|
37
|
+
|
38
|
+
* 1.0.0 Initial release
|
39
|
+
|
40
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jekyll/autonofollow"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll/autonofollow/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-autonofollow"
|
8
|
+
spec.version = Jekyll::Autonofollow::VERSION
|
9
|
+
spec.authors = ["techiediaries"]
|
10
|
+
spec.email = ["techiediaries9@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "jekyll-autonofollow is a Jekyll plugin that adds rel='nofollow' to all external urls in your posts."
|
13
|
+
spec.description = "jekyll-autonofollow is a Jekyll plugin that adds rel='nofollow' to all external urls in your posts."
|
14
|
+
spec.homepage = "https://www.techiediaries.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "jekyll/autonofollow/version"
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
Jekyll::Hooks.register :posts, :post_render do |post|
|
5
|
+
# code to call after Jekyll renders a post
|
6
|
+
content = Nokogiri::HTML(post.content)
|
7
|
+
site = post.site
|
8
|
+
config = site.config
|
9
|
+
#print config['nofollow']
|
10
|
+
|
11
|
+
content.css("a").each do |a|
|
12
|
+
#next unless
|
13
|
+
#next unless ! excludes.include? a.get_attribute('href')
|
14
|
+
next unless a.get_attribute('href') =~ /\Ahttp/i
|
15
|
+
#puts a.get_attribute("href")
|
16
|
+
#puts a.get_attribute("href").start_with?("http")
|
17
|
+
|
18
|
+
a.set_attribute("rel", "external nofollow")
|
19
|
+
a.set_attribute("target","_blank")
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
post.content = content.to_s
|
25
|
+
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-autonofollow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- techiediaries
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: jekyll-autonofollow is a Jekyll plugin that adds rel='nofollow' to all
|
42
|
+
external urls in your posts.
|
43
|
+
email:
|
44
|
+
- techiediaries9@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- jekyll-autonofollow.gemspec
|
57
|
+
- lib/jekyll/autonofollow.rb
|
58
|
+
- lib/jekyll/autonofollow/version.rb
|
59
|
+
homepage: https://www.techiediaries.com
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata:
|
63
|
+
allowed_push_host: https://rubygems.org
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: jekyll-autonofollow is a Jekyll plugin that adds rel='nofollow' to all external
|
84
|
+
urls in your posts.
|
85
|
+
test_files: []
|