summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
authorflan <flan@flande.re>2017-01-16 00:33:31 +0100
committerYorhel <git@yorhel.nl>2017-01-19 08:48:19 +0100
commite868c1f2d95b7701cb08b08f9d01e9a5b74079e8 (patch)
tree6dd787c69086b19be965beebc41479a6e415708b /lib/VNDB/Handler
parent73b51ebe80c6edc4c89514fc4217fd30fd2d8ad4 (diff)
Add Open Graph tags for the main page and vrspc
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Chars.pm8
-rw-r--r--lib/VNDB/Handler/Misc.pm16
-rw-r--r--lib/VNDB/Handler/Producers.pm7
-rw-r--r--lib/VNDB/Handler/Releases.pm7
-rw-r--r--lib/VNDB/Handler/Staff.pm7
-rw-r--r--lib/VNDB/Handler/VNPage.pm13
6 files changed, 50 insertions, 8 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index 392bf446..5caf677e 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -28,7 +28,13 @@ sub page {
)->[0];
return $self->resNotFound if !$r->{id};
- $self->htmlHeader(title => $r->{name}, noindex => $rev);
+ my $metadata = {
+ 'og:title' => $r->{name},
+ 'og:description' => $r->{desc},
+ 'og:image' => $r->{image} && imgurl(ch => $r->{image}),
+ };
+
+ $self->htmlHeader(title => $r->{name}, noindex => $rev, metadata => $metadata);
$self->htmlMainTabs(c => $r);
return if $self->htmlHiddenMessage('c', $r);
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 9cdbf4e2..6bda8091 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -35,12 +35,22 @@ TUWF::register(
sub homepage {
my $self = shift;
- $self->htmlHeader(title => 'The Visual Novel Database', feeds => [ keys %{$self->{atom_feeds}} ]);
+
+ my $title = 'The Visual Novel Database';
+ my $desc = 'VNDB.org strives to be a comprehensive database for information about visual novels.';
+
+ my $metadata = {
+ 'og:type' => 'website',
+ 'og:title' => $title,
+ 'og:description' => $desc,
+ };
+
+ $self->htmlHeader(title => $title, feeds => [ keys %{$self->{atom_feeds}} ], metadata => $metadata);
div class => 'mainbox';
- h1 'The Visual Novel Database';
+ h1 $title;
p class => 'description';
- txt 'VNDB.org strives to be a comprehensive database for information about visual novels.';
+ txt $desc;
br;
txt 'This website is built as a wiki, meaning that anyone can freely add'
.' and contribute information to the database, allowing us to create the'
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index bde7a07d..42c4e7f0 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -50,7 +50,12 @@ sub page {
)->[0];
return $self->resNotFound if !$p->{id};
- $self->htmlHeader(title => $p->{name}, noindex => $rev);
+ my $metadata = {
+ 'og:title' => $p->{name},
+ 'og:description' => $p->{desc},
+ };
+
+ $self->htmlHeader(title => $p->{name}, noindex => $rev, metadata => $metadata);
$self->htmlMainTabs(p => $p);
return if $self->htmlHiddenMessage('p', $p);
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 31026efe..19fa0678 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -28,7 +28,12 @@ sub page {
)->[0];
return $self->resNotFound if !$r->{id};
- $self->htmlHeader(title => $r->{title}, noindex => $rev);
+ my $metadata = {
+ 'og:title' => $r->{title},
+ 'og:description' => $r->{notes},
+ };
+
+ $self->htmlHeader(title => $r->{title}, noindex => $rev, metadata => $metadata);
$self->htmlMainTabs('r', $r);
return if $self->htmlHiddenMessage('r', $r);
diff --git a/lib/VNDB/Handler/Staff.pm b/lib/VNDB/Handler/Staff.pm
index 378bbd91..ca2f9842 100644
--- a/lib/VNDB/Handler/Staff.pm
+++ b/lib/VNDB/Handler/Staff.pm
@@ -27,7 +27,12 @@ sub page {
)->[0];
return $self->resNotFound if !$s->{id};
- $self->htmlHeader(title => $s->{name}, noindex => $rev);
+ my $metadata = {
+ 'og:title' => $s->{name},
+ 'og:description' => $s->{desc},
+ };
+
+ $self->htmlHeader(title => $s->{name}, noindex => $rev, metadata => $metadata);
$self->htmlMainTabs('s', $s) if $id;
return if $self->htmlHiddenMessage('s', $s);
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 5f8f8f3a..4cdcb166 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -341,7 +341,18 @@ sub page {
my $r = $self->dbReleaseGet(vid => $vid, what => 'producers platforms', results => 200);
- $self->htmlHeader(title => $v->{title}, noindex => $rev);
+ my $metadata = {
+ 'og:title' => $v->{title},
+ 'og:description' => $v->{desc},
+ };
+
+ if($v->{image} && !$v->{img_nsfw}) {
+ $metadata->{'og:image'} = imgurl(cv => $v->{image});
+ } elsif(my ($ss) = grep !$_->{nsfw}, @{$v->{screenshots}}) {
+ $metadata->{'og:image'} = imgurl(st => $ss->{id});
+ }
+
+ $self->htmlHeader(title => $v->{title}, noindex => $rev, metadata => $metadata);
$self->htmlMainTabs('v', $v);
return if $self->htmlHiddenMessage('v', $v);