diff options
author | Jochen Topf <jochen@topf.org> | 2015-02-27 10:04:55 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2015-02-27 10:04:55 +0100 |
commit | 89fb3c5faa448115d690328c5ce2538831880122 (patch) | |
tree | 7cebace49c6a4ef10e0251a069f9f41d497317b4 | |
parent | 441dce41853082a062afdfac805421f204b64f34 (diff) | |
download | taginfo-89fb3c5faa448115d690328c5ce2538831880122.tar taginfo-89fb3c5faa448115d690328c5ce2538831880122.tar.gz |
Add rel="nofollow" to project links.
To discourage spam. The links are created from javascript, so search engines
will have a hard time picking them up anyway. Oh well, better safe than sorry.
-rw-r--r-- | web/public/js/taginfo.js | 8 | ||||
-rw-r--r-- | web/views/project.erb | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index c8b7a25..92e7f70 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -228,6 +228,14 @@ function link_to_url(url) { ); } +function link_to_url_nofollow(url) { + return link( + encodeURI(url), + html_escape(url.replace(/^http:\/\//, '')), + { target: '_blank', 'class': 'extlink', 'rel': 'nofollow' } + ); +} + function highlight(str, query) { return html_escape(str).replace(new RegExp('(' + html_escape(query) + ')', 'gi'), "<b>$1</b>"); } diff --git a/web/views/project.erb b/web/views/project.erb index c4ff153..b82f925 100644 --- a/web/views/project.erb +++ b/web/views/project.erb @@ -37,16 +37,16 @@ function page_init2() { doc_url = #{ @project['doc_url'].to_json }; if (project_url) { - jQuery('#project_url').html(link_to_url(project_url)); + jQuery('#project_url').html(link_to_url_nofollow(project_url)); } if (icon_url) { jQuery('#icon_url').html(img({ src: icon_url, width: 16, height: 16, alt: ''})); } if (json_url) { - jQuery('#json_url').html(link_to_url(json_url)); + jQuery('#json_url').html(link_to_url_nofollow(json_url)); } if (doc_url) { - jQuery('#doc_url').html(link_to_url(doc_url)); + jQuery('#doc_url').html(link_to_url_nofollow(doc_url)); } init_tabs([project]); |