Introduced some basic metadata information
Change-Id: I4fab9d39a86200637cd780ba293e9982f4f0724b
diff --git a/Changes b/Changes
index 1cfa912..70633ba 100755
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.29 2018-09-19
+0.29 2018-10-05
- Deprecated Kalamar.api configuration key
in favor of Kalamar.api_path.
- Fix replacement of docs with docGroupRefs in
@@ -6,6 +6,7 @@
- Improve touch support for menus.
- Improve touch support for annotation assistant.
- Move token table view to marked match.
+ - Added metadata headers.
0.28 2018-08-29
- Introduced Widget based plugin system.
diff --git a/Makefile.PL b/Makefile.PL
index 82090c8..bebe29d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -28,7 +28,7 @@
# Currently on GitHub only (github.com/akron)
'Mojolicious::Plugin::Search' => 0.07,
- 'Mojolicious::Plugin::Localize' => 0.18,
+ 'Mojolicious::Plugin::Localize' => 0.20,
'Mojolicious::Plugin::TagHelpers::ContentBlock' => 0.08,
},
test => {
diff --git a/kalamar.dict b/kalamar.dict
index bbe4ed4..623f7be 100644
--- a/kalamar.dict
+++ b/kalamar.dict
@@ -53,6 +53,7 @@
-short => 'KorAP',
desc => 'KorAP - Korpusanalyseplattform der nächsten Generation',
overview => 'KorAP - Übersicht',
+ keywords => 'KorAP, DeReKo, Korpussuche, IDS Mannheim, Institut für Deutsche Sprache',
},
privacy => 'Datenschutz',
imprint => 'Impressum',
@@ -142,7 +143,10 @@
korap => {
-short => 'KorAP',
desc => 'KorAP - Corpus Analysis Platform',
- overview => 'KorAP - Overview'
+ overview => 'KorAP - Overview',
+ region => 'DE-BW',
+ placename => 'Mannheim',
+ keywords => 'KorAP, DeReKo, Corpus Query Platform, IDS Mannheim, Institute for the German Language'
},
QL => {
poliqarp => 'Poliqarp',
diff --git a/t/basic.t b/t/basic.t
index 0bbc09e..fd48b43 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -2,6 +2,7 @@
use Test::More;
use Test::Mojo;
use Mojo::File qw/path/;
+use utf8;
my $t = Test::Mojo->new('Kalamar');
@@ -31,11 +32,22 @@
->text_is('title', 'KorAP - Corpus Analysis Platform')
->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
->element_exists('div.intro')
- ->text_is('div.intro h2', 'This is a custom intro page!');
+ ->text_is('div.intro h2', 'This is a custom intro page!')
+ ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]')
+ ->element_exists('meta[name="keywords"][content^="KorAP"]')
+ ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]')
+ ;
$t->get_ok('/huhuhuhuhu')
->status_is(404)
->text_is('title', 'KorAP: 404 - Page not found')
->text_is('h1 span', 'KorAP: 404 - Page not found');
+$t->get_ok('/?q=hui')
+ ->status_is(200)
+ ->text_is('title', 'KorAP: Find »hui« with Poliqarp')
+ ->element_exists('meta[name="DC.title"][content="KorAP: Find »hui« with Poliqarp"]')
+ ->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]')
+ ;
+
done_testing();
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index ab50acf..5f9983c 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -1,9 +1,45 @@
<!DOCTYPE html>
-<html>
- <head>
+% my $lang = app->localize->preference // 'en';
+% my $desc = loc('korap_desc');
+% my $keywords = loc('korap_keywords');
+<html lang="<%= $lang %>" xml:lang="<%= $lang %>" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/">
+ <head prefix="og: http://ogp.me/ns# website: http://ogp.me/ns/website#">
<title><%= title() // loc('korap_desc') %></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=false, user-scalable=no" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <meta name="msapplication-TileImage" content="<%= url_for '/img/windows-tile.png' %>" />
+ <meta name="msapplication-TileColor" content="#9bad0b" />
+ <meta name="robots" content="index,follow" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="default" />
+ <meta name="description" content="<%= $desc %>" />
+ <meta name="language" content="<%= $lang %>" />
+ <meta name="author" content="The KorAP Team" />
+ <meta name="DC.type" content="service" />
+ <meta name="DC.creator" content="IDS Mannheim" />
+ <meta name="DC.title" content="<%= title() || loc('korap_short') %>" />
+ <meta name="DC.description" content="<%= $desc %>" />
+ <meta name="DC.format" content="text/html" />
+ <meta name="DC.contributor" content="The KorAP Team" />
+ <meta name="DC.publisher" content="IDS Mannheim" />
+ <meta name="DC.language" content="<%= $lang %>" />
+ <meta property="og:url" content="<%= url_for->to_abs %>" />
+ <meta property="og:locale" content="<%= $lang %>" />
+ <meta property="og:description" content="<%= $desc %>" />
+ <meta property="og:image" content="<%= url_for '/img/korap-200.png' %>" />
+ <meta property="og:image:width" content="200" />
+ <meta property="og:image:height" content="200" />
+ <meta name="twitter:image" content="<%= url_for '/img/korap-280.png' %>" />
+ <meta name="twitter:description" content="<%= $desc %>" />
+ <meta name="geo.region" content="<%= loc 'korap_region' %>" />
+ <meta name="geo.placename" content="<%= loc 'korap_placename' %>" />
+ <meta name="keywords" content="<%= $keywords %>" />
+ <meta name="DC.subject" content="<%= $keywords %>" />
+
+ <link rel="apple-touch-icon" href="<%= url_for '/img/apple-touch-icon.png' %>" />
<link href="<%= stash 'prefix' %>/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="<%= stash 'prefix' %>/css/kalamar-<%= $Kalamar::VERSION %>.css" type="text/css" rel="stylesheet" />
%= javascript begin
@@ -21,7 +57,7 @@
</head>
% my $embedded = 0;
% $embedded = 1 if stash('embedded');
- <body class="no-js<% if ($embedded) { %> embedded<% } %>">
+ <body class="no-js<% if ($embedded) { %> embedded<% } %>" itemscope itemtype="http://schema.org/<%= stash('schematype') || 'WebApplication' %>">
<script>document.body.classList.remove('no-js');</script>
<div id="kalamar-bg"></div>
diff --git a/templates/search.html.ep b/templates/search.html.ep
index e172e0e..21589ee 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -1,4 +1,4 @@
-% layout 'main', title => loc('searchtitle', q => search->query, ql => search->query_language);
+% layout 'main', title => loc('searchtitle', q => search->query, ql => search->query_language), schematype => 'SearchResultsPage';
<div id="resultinfo" <% if (search->results->size) { %> class="found"<%} %>>
<div id="pagination"><%= pagination(search->start_page, search->total_pages, url_with->query(['p' => '{page}'])) =%></div>