-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript
More file actions
executable file
·84 lines (75 loc) · 3.46 KB
/
Copy pathscript
File metadata and controls
executable file
·84 lines (75 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render('index');
};
get '/url=*redirect' => sub {
my $self = shift;
my $url = $self->stash('redirect');
if ($url) {
unless ($url =~ m{^https?://}i) {
$url = 'http://' . $url;
}
$self->res->headers->add('X-Robots-Tag' => 'nofollow');
return $self->redirect_to($url);
} else {
$self->redirect_to('/');
}
};
get '/robots.txt' => sub {
my $self = shift;
$self->render( text => { template => 'robots'});
};
app->start;
__DATA__
@@ robots.txt
User-agent: *
Disallow: /url
@@ index.html.ep
% layout 'default';
% title 'Nofollow.me: a rel=nofollow alternative';
<h1>nofollow.me</h1>
<h5>a rel=nofollow alternative for the rest of us</h5>
<p class="lead">Quick, easy & transparent URL redirection, blocking search engines along the way.</p>
<p>Sometimes you don't want links to be followed. Sometimes your 20 year old <acronym title="Content Management System">CMS</acronym> doesn't allow you to apply
<a href="http://nofollow.me/url=https://support.google.com/webmasters/answer/96569?hl=en">rel="nofollow"</a> attributes easily (or at all).</p>
<p>Google suggests either using a rel=nofollow attribute or redirecting links through an <a href="http://nofollow.me/url=https://support.google.com/webmasters/answer/66356?hl=en&rd=1">intermediate page</a> that's blocked using robots.txt.
Nofollow.me blocks search engines from following links by using both robots.txt and the
<a href="http://nofollow.me/url=https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag">X-Robots-Tag</a> HTTP header, protecting your site from evil <a href="http://nofollow.me/url=http://en.wikipedia.org/wiki/Google_Penguin">Penguins</a>!</p>
<p>Simply construct your URL below:</p>
<div class="input-prepend">
<span class="add-on">http://nofollow.me/url=</span>
<input type="url" placeholder="http://untrusted-url-here.com/" id="url" onkeyup="update('url');" class="span8">
</div>
<div id="build" class="well"></div>
<p>Then as per <a href="http://nofollow.me/url=https://support.google.com/webmasters/answer/35769?hl=en">Google's Webmaster Guidelines</a> you won't get <a href="http://nofollow.me/url=http://searchenginewatch.com/article/2252255/Interflora-Google-Penalty-Advertorials-SEO-Content-Marketing">banned</a> from Google for flowing <a href="http://nofollow.me/url=http://en.wikipedia.org/wiki/PageRank">PageRank</a> to the <a href="http://nofollow.me/url=http://www.google.co.uk/intl/en_uk/insidesearch/howsearchworks/fighting-spam.html">wrong sites</a>!</p>
<footer>© 2013 <a href="http://robhammond.co/">rob hammond</a> - <a href="https://github.com/robhammond/nofollow">fork me on github</a></footer>
<script>
function update(element){
var typed = document.getElementById(element).value;
document.getElementById("build").innerHTML = "<a rel='nofollow' href='http://nofollow.me/url=" + typed + "'>http://nofollow.me/url=" + typed + "</a>";
}
</script>
<style>
#build a {
font-size:20px;
color:green;
}
footer {
font-size: 12px;
bottom: 15px;
position:absolute;
}
</style>
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container"><%= content %></div></body>
</html>