diff options
author | Eric Wong <e@80x24.org> | 2016-01-19 01:16:19 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-05 18:58:27 +0000 |
commit | e90aa39b6447ceef78d31d4c68291585eb02244a (patch) | |
tree | b1307ffb83ae07a12ee90cb14228c8f00b56a088 /lib/PublicInbox/RepobrowseGitTree.pm | |
parent | 2b79ca6a1f3f12cac616b2bce800f7f9487c8170 (diff) | |
download | public-inbox-e90aa39b6447ceef78d31d4c68291585eb02244a.tar.gz |
It is expensive and of dubious usefulness to have tree content auto-followed and indexed by search engines. Reduce the links we recommend to crawlers so they don't waste resources of users running our code or waste the time of search engine users finding low-value content. We will allow indexing blobs, however, as they may contain useful information for others to refer to. Of course, I definitely want search engines to index commit messages; as I consider those to be the most important data served.
Diffstat (limited to 'lib/PublicInbox/RepobrowseGitTree.pm')
-rw-r--r-- | lib/PublicInbox/RepobrowseGitTree.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/PublicInbox/RepobrowseGitTree.pm b/lib/PublicInbox/RepobrowseGitTree.pm index d499cb4b..ceb28910 100644 --- a/lib/PublicInbox/RepobrowseGitTree.pm +++ b/lib/PublicInbox/RepobrowseGitTree.pm @@ -36,12 +36,16 @@ sub git_tree_stream { } my $fh = $res->([200, ['Content-Type'=>'text/html; charset=UTF-8']]); - $fh->write('<html><head>'. PublicInbox::Hval::STYLE . - '<title></title></head><body>'); + my $opts = { nofollow => 1 }; + my $title = $req->{expath}; + $title = $title eq '' ? 'tree' : utf8_html($title); if ($type eq 'tree') { + $opts->{noindex} = 1; + $fh->write($self->html_start($req, $title, $opts) . "\n"); git_tree_show($req, $fh, $git, $hex, $q); } elsif ($type eq 'blob') { + $fh->write($self->html_start($req, $title, $opts) . "\n"); git_blob_show($req, $fh, $git, $hex, $q); } else { # TODO @@ -87,7 +91,7 @@ sub git_blob_show { my $plain = join('/', "${rel}plain", @{$req->{extra}}); $plain = PublicInbox::Hval->utf8($plain)->as_path . $q->qs; my $t = cur_path($req, $q); - my $h = qq{<pre>path: $t\n\nblob $hex}; + my $h = qq{\npath: $t\n\nblob $hex}; my $end = ''; $git->cat_file($hex, sub { @@ -141,11 +145,10 @@ sub git_blob_show { sub git_tree_show { my ($req, $fh, $git, $hex, $q) = @_; - $fh->write('<pre>'); my $ls = $git->popen(qw(ls-tree -l -z), $git->abbrev, $hex); my $t = cur_path($req, $q); my $pfx; - $fh->write("path: $t\n\n"); + $fh->write("\npath: $t\n\n"); my $qs = $q->qs; if ($req->{tslash}) { |